home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / DOCS / SBASEP4D.LHA / SuperBasePart3.doc < prev    next >
Encoding:
Text File  |  1994-11-27  |  96.3 KB  |  3,013 lines

  1.  
  2. Part 3
  3.  
  4.  
  5. EXAMPLES
  6. 1    REM Top of program
  7.     ON ERROR GOTO errlab1
  8.     SELECT FIRST:? fieldname
  9.     .....
  10.     .....
  11.     errlab1:IF ERRNO=44 THEN OPEN FILE "aaa":REM file not open
  12.     RESUME
  13. 2    REM read data
  14.     ON ERROR GOTO errlab2
  15.     .....
  16.     READ x$
  17.     .....
  18.     endread:.....
  19.     .....
  20.     .....
  21.     errlab2:IF ERRNO=18 THEN RESUME endread:REM out of data
  22.  
  23. RETURN
  24. PURPOSE
  25. Returns from a subroutine.
  26.  
  27. SYNTAX
  28. RETURN
  29.  
  30. COMMENTS
  31. The RETURN command is used to mark the end of a subroutine. It instructs the
  32. computer to transfer prgram control to the statement immediately following 
  33. the GOSUB or ON GOSUB statement which initially called the subroutine. See 
  34. GOSUB.
  35.  
  36. RIGHT$
  37. PURPOSE
  38. Extracts one or more characters from a text string or text field, starting 
  39. from the right-hand end of the string.
  40.  
  41. SYNTAX
  42. RIGHT$(strexpr, nexpr)
  43.  
  44. COMMENTS
  45. This function starts at the right of a string given in strexpr and extracts
  46. nexpr characters.
  47.  
  48. EXAMPLES
  49. 1    textfieldc=RIGHT$(textfielda, 10)
  50. 2    textfieldc=LCASE$(RIGHT$(textfielda, 1))
  51. 3    IF RIGHT$(textfielda, 1)="s" THEN....
  52. 4    x$=RIGHT$("ABCD", 2)
  53. 5    x$=RIGHT$(x$, 4)
  54.  
  55. RND
  56. PURPOSE
  57. Returns a random number.
  58.  
  59. SYNTAX
  60. RND(nexpr)
  61.  
  62. COMMENTS
  63. What the function returns depends on the value of nexpr.
  64. It nexpr is less than zero, the random number generator is reseeded. This 
  65. means that a new series of random numbers will be generated, completely 
  66. unrelated to the last series. It also allows you to generate the same series 
  67. again for testing purposes, by entering the same seed.
  68. If nexpr is zero, the number returned is the same as the previous one.
  69. If nexpr is positive, a new random number is generated.
  70. The random number returned is in the range 0 to 1. Technically, it is never 
  71. zero and never unity, but all values between 0 and one will be randomly 
  72. generated and the distribution of numbers will be relatively flat.
  73.  
  74. EXAMPLES
  75. 1    numfieldc=RND(numfielda)
  76. 2    numfieldc=RND(2) * 12
  77. 3    textfieldc=MID$(x$, RND(2) * 6 + 1, RND(2) * 12 + 1)
  78. 4    $x=RND($y)
  79. 5    ? RND($x)
  80.  
  81. ROW
  82. PURPOSE
  83. Returns the row position of the cursor on the screen.
  84.  
  85. SYNTAX
  86. ROW(0)
  87.  
  88. COMMENTS
  89. This function shows how far down the screen the cursor is. For the column
  90. position, see COL.
  91.  
  92. EXAMPLES
  93. 1    x%=ROW(0)
  94. 2    ? ROW(0)
  95.  
  96. NOTES
  97. In practise, example 2 would be pointless, because it changes the position 
  98. of the cursor in the course of printing it.
  99.  
  100. RUN
  101. PURPOSE
  102. Executes a program from memory, or loads it from disk and then runs it.
  103.  
  104. SYNTAX
  105. RUN[filename]
  106.  
  107. COMMENTS
  108. This will run the program currently in memory when used as a command or as a
  109. program statement without the filename option. If filename is used to specify 
  110. a program, Superbase loads the program from disk and then runs it.
  111. If filename is specified, it must be a string variable or a string constant 
  112. in quotation marks.
  113.  
  114. SAVE
  115. PURPOSE
  116. Saves any of the following types of file:program, text, function key, query, 
  117. and update files.
  118.  
  119. SYNTAX
  120. SAVE [TEXT/KEY/QUERY/UPDATE]filename[, TEXT]
  121.  
  122. COMMENTS
  123. filename is required. Superbase detects files of different types as follows:
  124.     aaa.sbk is a saved function key set
  125.     aaa.sbp is a saved program
  126.     aaa.sbq is a saved query
  127.     aaa.sbt is a saved document(text)
  128.     aaa.sbu is a saved update
  129. If none of the options TEXT, KEY, QUERY or UPDATE is used, Superbase assumes 
  130. that filename refers to an '.sbp' file and attempt to save a program file. 
  131. If you include TEXT as the last parameter, DML saves a program file as a 
  132. text file. Only one of the options, TEXT, KEY, QUERY or UPDATE, can be used 
  133. at a time.
  134.  
  135. SAVE FILE
  136. PURPOSE
  137. Saves the current file definition.
  138.  
  139. SYNTAX
  140. SAVE FILE sbfname
  141.  
  142. COMMENTS
  143. When you create a new file, you can use MAKE to save the file definition. 
  144. SAVE FILE, however, must be used after you have edited a file definition 
  145. with MODIFY.
  146.  
  147. SAY
  148. PURPOSE
  149. Converts a text string into speech, using the Amiga's speech synthesis 
  150. facility.
  151.  
  152. SYNTAX
  153. SAY [USING parameters]exprlist
  154.  
  155. COMMENTS
  156. SAY is only available on the Amiga. The parameters for the USING option are in 
  157. this order:
  158.     Pitch, Inflection, Rate(wpm), Sex, Phonemic
  159. The following table gives the range of each parameter and its default value:
  160.  
  161. PARAMETER    RANGE        DEFAULT        NOTES
  162. Pitch        65-320        110
  163. Inflection    0-1        0        0 is expressive, 1 is monotone
  164. Rate in wpm    40-400        150
  165. Sex        0-10        0        0 is male, 1 is female
  166. Phonemic    0-1        0        0 translates to phonemes, 
  167.                         1 assumes phonemes
  168.  
  169. SAY only works with string expressions. To hear an external sound field use the 
  170. SHOW command.
  171.  
  172. EXAMPLES
  173. 1    OPEN FILE "Address"
  174.     SELECT FIRST
  175.     WHILE NOT EOF("Address")
  176.     SAY Forename;Lastname;"comes from";City;Country
  177.     SELECT NEXT
  178.     WEND
  179. 2    SAY USING 280, 1, 200, 1, 0"Hello there", USING 140, 1, 200, 0, 0
  180.     "Well, hello there"
  181.  
  182. SCRDUMP
  183. PURPOSE
  184. Outputs a copy of the screen to the printer-carries out a screen dump.
  185.  
  186. SYNTAX
  187. SCRDUMP
  188.  
  189. COMMENTS
  190. Only available on the Amiga.
  191.  
  192. SECS
  193. PURPOSE
  194. Returns the numbers of seconds from a time field.
  195.  
  196. SYNTAX
  197. SECS(nexpr)
  198.  
  199. COMMENTS
  200. nexpr will usually contain a time in milliseconds(thousandths of a second)
  201. from a time field or from the result of a TIMEVAL calculation.
  202.  
  203. EXAMPLES
  204. 1    scnds%=SECS(timefield)
  205. 2    scnds%=SECS(TIMEVAL("10:22AM"))
  206.  
  207. SELECT COMMANDS
  208. The following SELECT commands relate to Record selection:
  209.     SELECT CURRENT
  210.     SELECT DUPLICATE
  211.     SELECT FIRST
  212.     SELECT KEY
  213.     SELECT LAST
  214.     SELECT NEXT
  215.     SELECT PREVIOUS
  216.     SELECT REMOVE
  217.     SELECT WHERE
  218.  
  219. SELECT commands can only be used on an open database file, although this does
  220. not have to be the current file.
  221. These commands do not display records on screen. To do this, you need to use
  222. VIEW. Similarly, although they can be used with any open file, the SELECT
  223. commands do not automatically make an open file the current file.
  224. For example, SELECT LAST selects the last record in a file(on index)even if 
  225. the file is not current. If the file is current, executing the VIEW command 
  226. will be enough to display the last record. But with any other open file, you 
  227. will also need to use the FILE command(as opposed to the FILE parameter)
  228. before you can display the record(FILE makes an open file the current file).
  229.  
  230. SELECT CURRENT
  231. PURPOSE
  232. Selects the current record.
  233.  
  234. SYNTAX
  235. SELECT CURRENT [FILE sbfname] [INDEX index]
  236.  
  237. COMMENT
  238. This command has the same effect as the Current Record button on the Control
  239. Panel at the bottom of the screen. Use INDEX to select the current record 
  240. using a different index.
  241.  
  242. SELECT DUPLICATE
  243. PURPOSE
  244. Selects the next record with the same key.
  245.  
  246. SYNTAX
  247. SELECT DUPLICATE [INDEX index]
  248.  
  249. COMMENTS
  250. This command finds the next record with the same key as the current key. The
  251. key is the field on which the file is currently indexed. If SELECT DUPLICATE
  252. fails to find a record with the same key, the EOF function is set to true.
  253.  
  254. 1    SELECT FIRST:VIEW:x%=1
  255.     lab1:SELECT DUPLICATE
  256.     IF NOT EOF("aaa")THEN VIEW:x%=x% + 1:GOTO lab1
  257.     ? "End of ";x%; "duplicates-strike key"
  258.     lab2:SELECT PREVIOUS:SELECT NEXT:IF EOF("aaa")THEN END
  259.     CLS:VIEW:GOTO lab1
  260. Example 1 displays duplicate entries on an index. In Table view, it shows 
  261. a set of records at a time.
  262.  
  263. SELECT FIRST
  264. PURPOSE
  265. Selects the first record in the current or specified index sequence.
  266.  
  267. SYNTAX
  268. SELECT[FILE sbfname] [INDEX index]
  269.  
  270. COMMENTS
  271. This command has the same effect as the First Record button on the Control
  272. Panel. Use the INDEX parameter to alter the current index.
  273.  
  274. EXAMPLES
  275. 1    SELECT FIRST
  276. 2    SELECT FIRST "Stock" INDEX Prodcode
  277.  
  278. NOTES
  279. Example 1 selects the first record in the current file according to the 
  280. current index. Example 2 selects the first record in the Stock file according 
  281. to the Procode index.
  282.  
  283. SELECT KEY
  284. PURPOSE
  285. Selects the first record with matching string.
  286.  
  287. SYNTAX
  288. SELECT KEY string [FILE sbfname] [INDEX index]
  289.  
  290. COMMENTS
  291. This command has the same effect as the Key Lookup button on the Control Panel.
  292. It searches the file for the first record whose index field matches the 
  293. string specified.
  294. Unlike the other SELECT commands, this command does not affect the EOF 
  295. function, but instead sets the FOUND Function(see the example given for 
  296. FOUND).
  297.  
  298. EXAMPLES
  299. 1    SELECT KEY "Zollinger"
  300.     VIEW
  301. 2    SELECT KEY "Johnson" FILE "Customer" INDEX Lastname
  302.     IF FOUND("Customer")THEN FILE "Customer":VIEW
  303.  
  304. NOTES
  305. Example 1 selects the record in the current file whose Lastname field 
  306. contains the name Zollinger. It assumes that the current file is indexed on 
  307. Lastname.
  308. The program in example 2 selects the record in the Customer file whose 
  309. Lastname field contains the name Johnson. The Customer file must have 
  310. already been opened, but it does not have to be the current file. If the 
  311. program finds a record with a matching key, it uses the FILE command 
  312. to make the Customer file current and then displays the record.
  313.  
  314. SELECT LAST
  315. PURPOSE
  316. Selects the last record in the current or specified index sequence.
  317.  
  318. SYNTAX
  319. SELECT [FILE sbfname] [INDEX index]
  320.  
  321. COMMENTS
  322. Has the same effect as the Last Record button on the Control Panel.
  323.  
  324. SELECT NEXT
  325. PURPOSE
  326. Selects the next record in the current or specified index sequence.
  327.  
  328. SYNTAX
  329. SELECT NEXT [FILE sbfname] [INDEX index]
  330.  
  331. COMMENT
  332. Has the same effect as the Next Record button on the Control Panel.
  333.  
  334. SELECT PREVIOUS
  335. PURPOSE
  336. Selects the previous record in the current or specified index sequence.
  337.  
  338. SYNTAX
  339. [FILE sbfname] [INDEX index]
  340.  
  341. COMMENTS
  342. This command has the same effect as the Previous button on the Control Panel.
  343.  
  344. SELECT REMOVE
  345. PURPOSE
  346. Removes the current record in the current file or another open file.
  347.  
  348. SYNTAX
  349. SELECT [FILE sbfname]
  350.  
  351. COMMENTS
  352. This command has the same effect as the Remove option on the Record menu.
  353.  
  354. SELECT WHERE
  355. PURPOSE
  356. Selects first record that matches the filter conditions or removes the filter.
  357.  
  358. SYNTAX
  359. SELECT WHERE[[FILE sbfname] [conditions]]
  360.  
  361. COMMENTS
  362. This command has the same effect as the Filter button on the Control Panel.
  363. conditions is set up in the same way as the string gadget in the Filter
  364. requestor. If not specified, the current filter conditions are cleared.
  365. SELECT WHERE can only be used to set a single file filter. If you enter the
  366. name of a field which also occurs in another open file, you should include 
  367. the file the file name as an extension. Otherwise, Superbase may assume you 
  368. are attempting to use this command in a multi-file operation, and will issue 
  369. the error message:
  370.     Can't do this
  371.     This Where statement must be single file
  372. If you wish to set a multi-file filter - to select records whose field data
  373. matches the data in another file - use the LOOKUP function or the query
  374. language command WHERE.
  375.  
  376. EXAMPLE
  377. 1    SELECT WHERE fielda LIKE "[a-c]"
  378. 2    SELECT WHERE "Stock" fieldb LIKE "[a-c]"
  379. 3    SELECT WHERE
  380.  
  381. NOTES
  382. Once set, the Control Panel filters remains active until it is cleared. 
  383. Example 3 clears the filter which may have been set by a previous SELECT 
  384. WHERE command or by direct entry in the filter dialog.
  385.  
  386. QUERY LANGUAGE COMMANDS
  387. DML's Query Language commans allow you to create a program which duplicates a
  388. Superbase query. These commands are used in report programs created by the
  389. Forms Editor; but they can also be used for any of the query applications
  390. described in Chapter 11, Volume 1 - sorting records, creating complex multi
  391. -file filters, merging files, and so on.
  392. In Superbase a query is defined by the four command lines in the query
  393. definition dialog(Chapter 5, Volume 1, introduces this dialog;Chapter 11 
  394. explains it in more detail). These command lines can be reproduced in a 
  395. program by using the query language commands. SELECT is used to define the 
  396. Fields command line;
  397. REPORT defines the Report command line;WHERE corresponds to the FILTER line; 
  398. and ORDER is used for the Order line.
  399. You will find a explanation of these commands under their respective keyword
  400. entries. Here, we will describe how they work together to form a query section.
  401. A query section must start with the SELECT command and it should end with END
  402. SELECT. Any other query language commands are optional;you will include them
  403. according to your requirements. Thus, if you wish to use a filter, you will
  404. include a WHERE command within the query section.
  405. Likewise, if you wish to use reporting functions such as SUM and COUNT, you 
  406. will need to insert a REPORT command after the SELECT command and before END 
  407. SELECT. You can think of REPORT, WHERE and ORDER as modifying the query 
  408. output which is specified with the SELECT command. When SELECT is used on 
  409. its own - to form a single line query section - it outputs data from each 
  410. record in a specified file(or files)in turn. For example:
  411.     SELECT Lastname.Address, Country.Address:
  412.     END SELECT
  413. This outputs a line showing the contents of the fields Lastname and Country 
  414. for each of the records in the Address file. As such, SELECT works in the 
  415. same way as the ? command except that it acts on all the records in a file.
  416. If you inserted TO PRINTER after Country.Address in the example above, SELECT
  417. would output data to the printer. The TO device parameter provides an
  418. equivalent to the Output options in the query definition dialog. You can use 
  419. to specify an output device other than the screen:the printer, an ASCII 
  420. file, or a new '.sbf' file.
  421.  
  422. A QUERY LANGUAGE EXAMPLE
  423. Any query created with the query definition dialog can be reproduced under
  424. program control. We can illustrate this by converting a query file(an '.sbq'
  425. file)into a program, taking the Deptran file supplied with the demonstration
  426. file disk as an example.
  427. Deptran can be displayed on screen using the LIST option from the System menu.
  428. It looks like this:
  429.     SB
  430.     CLIENTS
  431.     DEPOSITS
  432.     Deposit Transaction Report
  433.     ON "Clients" Firstname.Clients, Lastname.Clients, ON "Deposits"
  434.     @24 Bank, Amount, Deposits
  435.     REPORT SUM Amount COUNT GROUP Lastname.Clients SUM
  436.     Amount
  437.     Lastname.Clients=Lastname.Deposits
  438.     Lastname.Clients
  439. SB on the first line indicates that this is a Superbase Professional query 
  440. file as opposed to one created in Superbase Personal. The next two lines 
  441. contain the names of the database files which are associated with this query. 
  442. 'Deposit Transaction Report' is the query title, and the remaining lines 
  443. represent the four query command lines.
  444. Before we can load this file into the Program Editor, we need to change its 
  445. name to Deptran.sbp. To do this, select COPY from the System menu and, after 
  446. selecting Deptran.sbq as the file to be copied, enter then name Deptran.sbp.
  447. You can now load the file into the Program Editor using the Program open
  448. option. Coverting it to a program is just a matter of deleting two lines and
  449. inserting keywords in the others. Once you have made these changes, the 
  450. program should look like this:
  451.     OPEN FILES "CLIENTS"
  452.     OPEN FILE "DEPOSITS"
  453.     SELECT ON "Clients" Firstname.Clients, Lastname.Clients, ON
  454.     "Deposits" @24 Bank, Amount, Deposits
  455.     REPORT SUM Amount COUNT GROUP Lastname.Clients SUM
  456.     Amount
  457.     WHERE Lastname.Clients=Lastname.Deposits
  458.     ORDER Lastname.Clients
  459. Note that the report line is the same as in the query file and does not 
  460. need to be altered.
  461. If you now run this program, it will have the same effect as running Deptran
  462. from the query definition dialog(by clicking on OK).
  463.  
  464. SELECT
  465. PURPOSE
  466. Specifies which are to be output from a query.
  467.  
  468. SYNTAX
  469. SELECT [params]firlds[TO device]:[statements]:END SELECT
  470.  
  471. COMMENTS
  472. SELECT is a Query Language command and can used on its own or with other Query 
  473. Language commands to form a query section.
  474. fields can be one or more field names from one or multiple files.params 
  475. can be any of the output format parameters as listed in the section which 
  476. describes the ? commands.
  477. In addition, there are three format parameters which can only be used with 
  478. the SELECT command:ON file, AS heading and FIELD. The syntax and function 
  479. of these parameters in described in their respective sections in Chapter 11, 
  480. Volume 1.
  481. TO device specifies the device to which the query output will be sent. If it 
  482. is not included output is to the screen. The device options are:
  483.     TO PRINTER
  484. Outputs to the printer.
  485.     TO FILE file
  486. Creates a new '.sbf' file on disk under the file name specified, using the 
  487. query output.
  488.     TO file
  489. Outputs to the ASCII file on disk specified by file.
  490. statements can be other query language statements formed with the commands
  491. REPORT, WHERE, and ORDER.
  492. END SELECT is used to indicate the end of a query section. It is not always
  493. necessary to include END SELECT, but you must provide Superbase with some
  494. indication of where the query section finishes and where the rest of the
  495. program starts. Otherwise, the statements following the last line in the 
  496. query section will be interpreted as part of a multi-line SELECT statement. 
  497. As an alternative to END SELECT, you could use a blank line.
  498.  
  499. SER
  500. PURPOSE
  501. Returns the total number of records that have been created in a file.
  502.  
  503. SYNTAX
  504. SER(filename)
  505.  
  506. COMMENTS
  507. You can use the SER function to assign a serial number to each record in a
  508. file. To do this, you need to define a field which will hold the serial number.
  509. It should be defined as a constant field and should have SER("filename")as 
  510. its constant formula. When you create the first record, it will be given the 
  511. value 1. This value will then be incremented by one for each record you add 
  512. to the file.
  513. The difference between SER and RECCOUNT is that SER gives the total number of
  514. records that have been created, irrespective of whether they have been deleted 
  515. later. RECCOUNT returns the number of records currently in the file.
  516.  
  517. 1    ? SER("Stock")
  518. 2    BLANK
  519.     Recno.Stock=SER("STOCK")
  520.     Price.Stock=14.95
  521.     Description.Stock="Widget"
  522.     STORE
  523.  
  524. SET
  525. PURPOSE
  526. Reads a text file and executes any commands in the file, or assigns variables
  527. from a text file.
  528.  
  529. SYNTAX
  530. SET filename
  531.  
  532. COMMENTS
  533. This command reads in a text file and executes it as if it were a sequence of
  534. command. The file, therefore, must contain valid DML commands. If the file 
  535. holds a set of variables-which have previously been saved to disk by ? 
  536. MEMORY-the variable assignments are executed. This provides a way of 
  537. transferring variables between different programs when CHAIN is not 
  538. appropriate. For example, Program 'a' can set up variables for Program 
  539. 'c', but Program 'a' CHAINs to Program 'b'. Another application would be 
  540. to communicate variables between different programs which are run on 
  541. different days.
  542.  
  543. EXAMPLES
  544. 1    ......
  545.     process a
  546.     ......
  547.     OPEN "aaa" FOR OUTPUT:? MEMORY:CLOSE OUTPUT:DISPLAY
  548.     another program
  549.     SET "aaa"
  550.     ......
  551.     process b
  552. 2    SET "abc"
  553. 'abc' could be ASCII file which contains a set of function key assignments.
  554.  
  555. SET BUFFERS
  556. PURPOSE
  557. Sets the number of buffers Superbase uses as a disk cache.
  558.  
  559. SYNTAX
  560. SET BUFFERS nexp
  561.  
  562. COMMENTS
  563. Operates in the same way as the Buffers option in Set Menu Options, and
  564. allocates 512 bytes memory space for each buffer.
  565. nexp can have a value from 1 to 99.
  566.  
  567. EXAMPLES
  568. 1    SET BUFFERS 24
  569.  
  570. SET PAGING
  571. PURPOSE
  572. Sets paging on or off.
  573.  
  574. SYNTAX
  575. SET PAGING[ON/OFF]
  576.  
  577. COMMENTS
  578. When used without ON/OFF, it acts as toggle and operates in the same way 
  579. as the SET-PAGING menu options. With ON or OFF, it sets paging accordingly.
  580.  
  581. EXAMPLES
  582. 1    SET PAGING OFF
  583.  
  584. SET VIEW MODE
  585. PURPOSE
  586. Sets the view mode or switches between one of the view modes and a Form.
  587.  
  588. SYNTAX
  589. SET [TABLE]/[FORM]/[RECORD]
  590.  
  591. COMMENTS
  592. Works in the same way as the equivalent Set Menu option, except that it does 
  593. not automatically display a record(use VIEW).
  594. If a Form(as opposed to Form view)is displayed, the SET command switches the
  595. Form off and selects the specified view mode. The Form remains in memory and
  596. can be switched on again by repeating the SET command for the same view mode.
  597. In other words, when a Form has been opened, the SET command toggles the 
  598. current view mode on and off.
  599.  
  600. EXAMPLES
  601. 1    SET FORM
  602. 2    SET TABLE:VIEW
  603.  
  604. SGN
  605. PURPOSE
  606. Finds the sign of a number.
  607.  
  608. SYNTAX
  609. SGN(nexpr)
  610.  
  611. COMMENTS
  612. This function returns the positive value of 1 if nexpr is positive and returns
  613. the negative value -1 if nexpr is negative.
  614.  
  615. EXAMPLES
  616. 1    numfieldc=SGN(numfielda)
  617. 2    IF SGN(datefielda-datefieldb)THEN GOTO lab1
  618. 3    x%=SGN(y%)
  619. 4    x%=SGN(y% * numfielda * (datefielda-datefieldb))
  620. 5    x%=SGN(VAL(RIGHT$(textfielda, 5)))
  621. 6    ? SGN(x%)
  622.  
  623. NOTES
  624. Example 2 tests whether datefieldb is later than datefielda
  625.  
  626. SHOW
  627. PURPOSE
  628. Shows an external file.
  629.  
  630. SYNTAX
  631. SHOW [field]/[strexpr]
  632.  
  633. COMMENTS
  634. SHOW is the program equivalent of the camera button at the bottom of the
  635. screen. It displays a picture or text from an external file.field must be a
  636. field which holds the name of the external file, but it does not have to be a
  637. field in the current file:if you add a file name extension to the field name, 
  638. you can display pictures using other open database files.
  639. As an alternative to specifying an external field, strexpr allows you to 
  640. specify the name of an external file.
  641. When field or strexpr is not given, SHOW removes the picture from the screen.
  642.  
  643. SIN
  644. PURPOSE
  645. Returns the sine of an angle measured in radians.
  646.  
  647. SYNTAX
  648. SIN(nexpr)
  649.  
  650. COMMENTS
  651. This function returns the sine of the angle in nexpr, where the angle is
  652. measured in radians. To convert degrees to radians, multiply by 180/PI.
  653.  
  654. EXAMPLES
  655. 1    numfieldc=SIN(numfielda)
  656. 2    x%=SIN(y%)
  657. 3    x%=SIN(VAL(x$))
  658. 4    ? SIN(x%)
  659.  
  660. SPACE$
  661. PURPOSE
  662. Fills a string with a specified number of spaces.
  663.  
  664. SYNTAX
  665. SPACE$(nexpr)
  666.  
  667. COMMENTS
  668. nexpr must be in the range 0 to 255.
  669.  
  670. EXAMPLES
  671. 1    textfieldc=SPACE$(10)
  672. 2    x$=SPACE$(4)
  673.  
  674. SQR
  675. PURPOSE
  676. Returns the square root of a number
  677.  
  678. SYNTAX
  679. SQR(nexpr)
  680.  
  681. COMMENTS
  682. The function returns the square root of the number specified by nexpr. 
  683. If nexpr is less than zero, the function returns the error message 'ivalid 
  684. number'.
  685.  
  686. EXAMPLES
  687. 1    numfieldc=SQR(numfielda)
  688. 2    numfieldc=SQR(2 * numfirlda)
  689. 3    textfieldc=STR$(SQR(VAL(x$)))
  690. 4    x%=SQR(y%)
  691.  
  692. STORE
  693. PURPOSE
  694. Stores the current record in the current file or in the file specified.
  695.  
  696. SYNTAX
  697. STORE[, 0/1/2] [FILE sbfname]
  698.  
  699. COMMENTS
  700. This command stores the record in memory for the current file, or for the file
  701. specified with sbfname.
  702. It is equivalent to the Save option on the Record menu.
  703.  
  704. The numeric parameters - 0, 1 or 2 - allow you to specify whether the 
  705. record is stored in batch mode or in the normal way(see the section on 
  706. Batch in Chapter 5, Volume 1).
  707. STORE, 1 stores the current record in batch mode. The time taken to save the
  708. record on disk will be reduced, but the data will not yet be secure:if you
  709. suffer a power loss, you will lose any record data which has been saved(in 
  710. the current session)using this option. Note that STORE, 1 only turns on batch 
  711. mode for the current record.STORE, 2 does not store a record but makes the 
  712. file secure. Any records that have been saved previously with the STORE, 1 
  713. command will now be made safe on disk. You should always execute a STORE, 2 
  714. command after storing records in batch mode.
  715. STORE, 0 is optional and is the same as STORE on its own:Superbase makes each
  716. record secure as it is stored. If you were to turn the computer off
  717. accidentally, the most you would lose would be the data in memory.
  718.  
  719. EXAMPLES
  720. 1    BLANK
  721.     Firstname="John"
  722.     Lastname="Roberts"
  723.     Street="15 Richmond Way"
  724.     ......
  725.     ......
  726.     ......
  727.     STORE
  728. 2    FOR n%=1 to 10
  729.     BLANK
  730.     Firstname=Recdata$(n%, 1)
  731.     Lastname=Recadata$(n%, 2)
  732.     Street=Recdata$(n%, 3)
  733.     ......
  734.     ......
  735.     ......
  736.     STORE, 1
  737.     NEXT
  738.     STORE, 2
  739.  
  740. NOTES
  741. The first example creates a new record and stores it in the normal way. 
  742. Example 2 creates ten new records, reading data into the fields for 
  743. each record from the array Recdata$ and storing them in batch mode. 
  744. When all the records have been stored, it makes the file secure with 
  745. the STORE, 2 command.
  746.  
  747. STR$
  748. PURPOSE
  749. Returns the text equivalent of a numeric expression.
  750.  
  751. SYNTAX
  752. STR$(nexpr [[, nexpri [, nexprd]]/[, numeric-format-string]])
  753.  
  754. COMMENTS
  755. STR$ converts data which is held in a numeric variable or numeric field 
  756. into a text string.
  757. nexpri specifies the number of integers before the decimal point and should 
  758. be set large enough to avoid overflow display. nexprd specifies the number of
  759. integers after the decimal point. The maximum numeric format in Superbase is 
  760. a total of 13 integers, so nexpri plus nexprd must be less than 14. As an
  761. alternative to using nexpri and nexprd, you can specify the numeric format 
  762. as a string(see NUMBASE). If these parameters are not used, the default numeric
  763. format set by Numeric Format on the Set menu or by the most recent use of
  764. NUMBASE will be taken. The complementary function to STR$ is VAL.
  765.  
  766. EXAMPLES
  767. 1    textfieldc=STR$(numfielda)
  768. 2    textfieldc-STR$(numfielda, 5, 0)
  769. 3    x$=STR$(165.4444, "z999999.00")
  770.  
  771. TAN
  772. PURPOSE
  773. Returns the tangent of an angle measured in radians.
  774.  
  775. SYNTAX
  776. TAN(nexpr)
  777.  
  778. COMMENTS
  779. The function returns the tangent of the angle in nexpr measured in radians. 
  780. The complementary function of TAN is ATN.
  781.  
  782. EXAMPLES
  783. 1    numfieldc=TAN(numfielda)
  784. 2    x%=TAN(y%)
  785. 3    x%=TAN(VAL(x$))
  786. 4    ? TAN(x%)
  787.  
  788. THOUSECS
  789. PURPOSE
  790. Takes a numeric value and returns the number of thousandths of a second left
  791. over after subtracting the number of seconds.
  792.  
  793. SYNTAX
  794. THOUSECS(nexpr)
  795.  
  796. COMMENTS
  797. nexpr will usually contain a time in milliseconds from a time field or the
  798. result of a TIMEVAL calculation. THOUSECS returns the same result as nexpr 
  799. MOD 1000.
  800.  
  801. 1    x%=THOUSECS(timefield)
  802.  
  803. TIME$
  804. PURPOSE
  805. Returns the time in string format from a numeric value which gives the time 
  806. in thousandths of a second.
  807.  
  808. SYNTAX
  809. TIME$(nexpr [, timeformat])
  810.  
  811. COMMENTS
  812. The second argument for this function, timeformat, allows you to specify the
  813. format the time string will have. It must conform to the rules for Superbase
  814. time formats given in the keyword entry for DATEBASE.
  815.  
  816. EXAMPLES
  817. 1    x$=TIME$(timefield)
  818. 2    ? TIME$(NOW, "hh:mm:ssam")
  819.  
  820. TIMEVAL
  821. PURPOSE
  822. Returns the value of a time string in thousandths of a second.
  823.  
  824. SYNTAX
  825. TIMEVAL(strexpr)
  826.  
  827. COMMENTS
  828. strexpr must contain the time in a valid time format. See the keyword 
  829. entry for DATEBASE for a list of acceptable time formats.
  830.  
  831. EXAMPLES
  832. 1    t%=TIMEVAL("10:22am")
  833. 2    t%=TIMEVAL("14:03:12.201")
  834.  
  835. TODAY
  836. PURPOSE
  837. Gives the system date.
  838.  
  839. SYNTAX
  840. TODAY
  841.  
  842. COMMENTS
  843. TODAY shows the date in the date format as set with Date Format option in the
  844. Set menu, or as set by the DATEBASE command. If your computer has a real-time
  845. clock or you have set the systeme date, TODAY gives the current date. 
  846. Otherwise, it gives the default system date.
  847. TODAY holds the date as a julian date number. Superbase automatically
  848. translates this into the current date format when you display the date using ?
  849. TODAY.
  850.  
  851. EXAMPLES
  852. 1    ? TODAY
  853. 2    datefield=TODAY
  854. 3    ? MONTH(TODAY)
  855.  
  856. TRIM$
  857. PURPOSE
  858. Trims trailing spaces from a string or a text field.
  859.  
  860. SYNTAX
  861. TRIM$(strexpr)
  862.  
  863. COMMENTS
  864. This returns the string consisting of the original string specified by 
  865. strexpr with any trailing spaces eliminated.
  866.  
  867. EXAMPLES
  868. 1    stringfieldc=TRIM$(textfielda)
  869. 2    x$=TRIM$(textfieldc.filea)
  870. 3    ? LEN(x$);LEN(TRIM$(x$)
  871.  
  872. UCASE$
  873. PURPOSE
  874. Returns the upper case equivalent of a text string or a text field.
  875.  
  876. SYNTAX
  877. UCASE$(strexpr)
  878.  
  879. COMMENTS
  880. UCASE$ returns the upper case equivalent of the lowercase alphabet;no other
  881. characters, including those already in upper case, are affected.
  882. The complementary function of UCASE$ is UCASE$.
  883.  
  884. EXAMPLES
  885. 1    textfieldc=UCASE$(textfielda)
  886. 2    x$=UCASE$(y$)
  887. 3    x$=UCASE$("ABCDEF")
  888.  
  889. NOTES
  890. If you wish to set the first letter of a string to upper case, leaving the 
  891. rest in lower case, you can so using the FCASE$ function.
  892.  
  893. UPDATE
  894. PURPOSE
  895. Performs a relational update.
  896.  
  897. SYNTAX
  898. UPDATE[calclist] [WHERE conditions] [END UPDATE]
  899.  
  900. COMMENTS
  901. UPDATE on its own runs the update in memory. This may have been loaded from
  902. disk with the LOAD UPDATE command, or it may have been created in the same
  903. session using the Process menu option Update Edit. By specifying calclist and 
  904. conditions, you can also use UPDATE to define an update and then run it. 
  905. calclist corresponds to command line set in the Update Fields dialog; 
  906. conditions corresponds to the filter which is set in the Update Filter dialog. 
  907. The first specifies how the records are updated, the second specifies which 
  908. records are to be updated.
  909. WHERE conditions and calclist should be entered as separate statements, 
  910. either on the same line as UPDATE separated by colons, or on separate lines. 
  911. They form part of an Update program section, headed by the UPDATE command 
  912. and ending with END UPDATE.
  913. The END UPDATE command must be included if the Update section is followed by
  914. other statements in a program. Otherwise Superbase will regard these as
  915. belonging to the Update section. As an alternative to using this command, you
  916. can terminate the section with a colon or a blank line.
  917. UPDATE is a multi-file command, so both conditions and calclist can refer to
  918. more than one file. In this case, the first condition in the update filter 
  919. must establish a join between two files.
  920.  
  921.                 5-155
  922.  
  923. EXAMPLES
  924. 1    LOAD UPDATE "Newrate":UPDATE
  925. Loads the Update file Newrate from disk, and then runs it.
  926. 2    UPDATE
  927.     Price.Orders=Price.Stock
  928.     WHERE Product_Code.Orders=Product_Code.Stock AND
  929.     Order_date "15 July 1987"
  930.     END UPDATE
  931. Updates prices in the Orders file on the basis of the price details in the
  932. Stock file.
  933.  
  934. VAL
  935. PURPOSE
  936. Returns the numeric value of a text string.
  937.  
  938. SYNTAX
  939. VAL(strexpr)
  940.  
  941. COMMENTS
  942. The function returns the numeric value of the number(if any)in the lefthand 
  943. end of the string or substring specified in strexpr. In cases where strexpr 
  944. does not contain a number or where the leftmost character of strexpr is not 
  945. numeric, the function returns 0.
  946. The complementary function of VAL is STR$
  947.  
  948. EXAMPLES
  949. 1    numfieldc=VAL(textfielda)
  950. 2    numfieldc=VAL(RIGHT$(textfielda, 8))
  951. 3    VAL(textfielda) > 1 AND VAL(RIGHT$(textfielda, 4) > 0
  952. 4    x%=VAL("12.45A456")
  953. 5    x%=VAL(x$)
  954.  
  955. VIEW
  956. PURPOSE
  957. Displays the current record in the current file.
  958.  
  959. SYNTAX
  960. VIEW
  961.  
  962. COMMENTS
  963. Allows the user to see the current record in the current file in the view
  964. format specified by the SET view mode command. It can also be used to 
  965. redisplay the current Form.
  966.  
  967. WAIT
  968. PURPOSE
  969. Waits for a specified time or until a key is pressed.
  970.  
  971. SYNTAX
  972. WAIT [FOR time]/[FOR nexp] [var/field]
  973.  
  974. COMMENTS
  975. Wait waits for a given number of seconds(FOR nexp)or until a given time(FOR
  976. time).
  977. FOR nexp implies 'wait for nexp seconds'.
  978. FOR time implies 'eait until the system clock reached time', where the time 
  979. is given in the current time format.
  980. FOR var/field implies 'wait until a key is pressed, and then place it in 
  981. var or field'. If you follow WAIT with a numeric variable or numeric field, 
  982. it will only accept a number. In other word, pressing any key except the 
  983. keys with the digits 0 to 9, will have no effect.
  984.  
  985. EXAMPLES
  986. 1    WAIT FOR 3
  987. Waits for 3 seconds.
  988. 2    WAIT FOR 10:20:30
  989. Wait until 10:20 am.
  990. 3    WAIT x$
  991. Waits for a single key stroke and puts it in x$.
  992.  
  993. WHERE
  994. PURPOSE
  995. Set the filter conditions for a query or a report.
  996.  
  997. SYNTAX
  998. WHERE conditions
  999.  
  1000. COMMENTS
  1001. WHERE is the program equivalent of the Filter command line in a query
  1002. definition, and can only be used within a section that is headed by the query
  1003. SELECT command. You can use WHERE to set a filter on the fields selected for
  1004. report output or for other query applications, such as sorting, merging files, 
  1005. or simply retrieving data with query that has been saved to disk.
  1006. conditions takes the same form as the Filter command line in the query
  1007. definition dialog(see Chapter 11, Volume 1). WHERE is a multi-file filter
  1008. command - unlike the record selection command SELECT WHERE - and if it used 
  1009. for this purpose, the join between two files must be placed at the beginning 
  1010. of the statement, as in:
  1011.     WHERE Lastname.Clients=Lastname.Deposits
  1012. Any subsidiary conditions can then be added to the line using the AND operator.
  1013.  
  1014. EXAMPLES
  1015. 1    SELECT Firstname.Clients, Lastname.Clients, Bank, Amount
  1016.     WHERE Lastname.Clients=Lastname.Deposits AND
  1017.     Lastname.Clients LIKE "[d-3]*"
  1018.     ORDER Lastname.Clients
  1019.     END SELECT
  1020. 2    WHERE Price > = 50 AND Price < = 100
  1021. 3    WHERE Lastname LIKE ["a-c"*] AND NOT (Country=USA)
  1022.  
  1023. NOTES
  1024. In the first exampe, WHERE is used to set up a multi-file filter. It selects
  1025. only those clients whose details are also stored in the Deposits file and 
  1026. whose last name initial falls in the range A to C. Note that file extension 
  1027. must be given for Lastname since the field occurs in both the Clients file 
  1028. and the Deposits file; the Bank and Amount fields do not require an extension 
  1029. name since they only occur in the Deposits file. The other two examples show 
  1030. WHERE in use as a single file filter command.
  1031.  
  1032. WHILE WEND
  1033. PURPOSE
  1034. Executes a series of instructions as long as the specified conditions are true.
  1035.  
  1036. SYNTAX
  1037. WHILE exp statements WEND
  1038.  
  1039. COMMENTS
  1040. WHILE and WEND set up a loop, in which the statement in between are executed
  1041. repeatedly for as long as the expression following WHILE is true. When the
  1042. expression is not true, execution resumes with the first statement after WEND.
  1043.  
  1044. EXAMPLES
  1045. 1    OPEN FILE "Address"
  1046.     SELECT FIRST
  1047.     WHILE NOT EOF("Address")
  1048.     VIEW
  1049.     SELECT NEXT
  1050.     WEND
  1051. 2    WHILE NOT EOF(*"):INPUT &1, a$:? a$:WEND
  1052.  
  1053. YEAR
  1054. PURPOSE
  1055. Returns a numeric value for the year from a julian date number.
  1056.  
  1057. SYNTAX
  1058. YEAR(nexp)
  1059.  
  1060. COMMENTS
  1061. The function is only valid for dates from 1 January 1 to the end of December
  1062. 9999. Consequently nexpr is only valid in the range 1 to 3652048. If nexpr 
  1063. is 0 then the number returned is 0. If nexpr is negative the results are
  1064. unpredictable. Associated date functions are DATE$ DAY DAYS DAY$ MONTH
  1065.  
  1066. EXAMPLES
  1067. 1    numfieldc=YEAR(datefielda)
  1068. 2    numfieldc=YEAR(datefielda + 90)
  1069. 3    numfieldc=YEAR(TODAY)
  1070. 4    x%=YEAR(datefielda + VAL(textfielda))
  1071. 5    x%=YEAR(DAYS("11 Jan 85")
  1072. 6    ? YEAR(datefielda + 30)
  1073. 7    YEAR(datefielda)=1986
  1074.  
  1075. NOTES
  1076. Example 3 provides a calculation to insert the month number of the system 
  1077. date into a numeric field. Example 7 provides a filter to pick out all 
  1078. the dates in datefields which fall in the year 1986.
  1079.  
  1080.             CHAPTER 6 - QUICK REFERENCE GUIDE
  1081.  
  1082. APPLICATION FUNCTIONS
  1083.  
  1084. RUN [filename]
  1085. Execute program, optionally loading from disk
  1086.  
  1087. CHAIN filename
  1088. Execute program without clearing variables
  1089.  
  1090. NEW [TEXT/QUERY/UPDATE]
  1091. Clear program or text area
  1092.  
  1093. EDIT [TEXT/KEY/QUERY/UPDATE]
  1094. Allow user to edit program, text, query or update
  1095.  
  1096. LOAD [TEXT/KEY/QUERY/UPDATE] filename [, APPEND]
  1097. Load program, text, file, function key list, query or update
  1098.  
  1099. SAVE [TEXT/KEY/QUERY/UPDATE] filename [, TEXT]
  1100. Save program, text file, function key list, query or update
  1101.  
  1102. PROTECT [filename]
  1103. Save the current program in encrypted form
  1104.  
  1105. CALL function
  1106. Call a user supplied function
  1107.  
  1108. SYSTEM COMMANDS
  1109.  
  1110. DEBUG [ON/OFF]
  1111. Set or clear debug flag
  1112.  
  1113. BREAK [ON/OFF]
  1114. Set or clear user stop enabled
  1115.  
  1116. QUIT
  1117. Exit Superbase system
  1118.  
  1119. KEY keynum [, string]
  1120. Set keynum to string or clear it
  1121.  
  1122. LIST filename
  1123. List any system file to screen
  1124.  
  1125. DELETE filename
  1126. Delete any system file
  1127.  
  1128. RENAME old filename [, TO] new filename
  1129.  
  1130. COPY from filename [, TO] to filename
  1131. Copy any system file
  1132.  
  1133. NUMBASE string
  1134. Set default numeric format
  1135.  
  1136. DATEBASE string
  1137. Set default date format
  1138.  
  1139. DIRECTORY path
  1140. Change directory to path
  1141.  
  1142. SET TABLE/RECORD/FORM
  1143. Set view according to parameter 
  1144.  
  1145. SET PAGING [ON/OFF]
  1146. Set paging
  1147.  
  1148. SET BUFFERS nexp
  1149. Set number of cache buffers to use
  1150.  
  1151. BASIC STATEMENTS
  1152.  
  1153. [LET] var/field=exp
  1154. Assign value of expression to variable or field
  1155.  
  1156. ERASE varlist
  1157. Remove a variable from memory
  1158.  
  1159. CLEAR
  1160. Clear all system variables
  1161.  
  1162. READ var/field [, var/field]
  1163. Read data into variables or fields from data pointer
  1164.  
  1165. DATA constant [, constant]...
  1166. Specify data for READ statement
  1167.  
  1168. RESTORE [label]
  1169. Move data pointer to specified position or home
  1170.  
  1171. REM text
  1172. Non executable comment line
  1173.  
  1174. EXECUTE string
  1175. Execute text string as though command
  1176.  
  1177. DIM array variable
  1178. Set array dimensions
  1179.  
  1180. CONTROL FLOW
  1181.  
  1182. FOR var=nexp TO nexp [STEP nexp]statements NEXT [var]
  1183. Repeat program lines a number of times
  1184.  
  1185. GOSUB label
  1186. Call a procedure or subroutine
  1187.  
  1188. GOTO label
  1189. Call a procedure or subroutine
  1190.  
  1191. GOTO label
  1192. Branch to the specified label
  1193.  
  1194. ON ERROR [GOTO label]
  1195. Specify procedure to be followed on error condition
  1196.  
  1197. ON nexp GOTO label [, label]...
  1198. Branch to statement or label in list
  1199.  
  1200. ON nexp GOSUB label [, label]...
  1201. Call procedure or subroutine in list
  1202.  
  1203. RETURN
  1204. Return from procedure or subroutine execution
  1205.  
  1206. RESUME [NEXT / label]
  1207. Resuume execution after error at next or specified position
  1208.  
  1209. END
  1210. Terminate execution of application
  1211.  
  1212. WHILE expr
  1213. Perform following commands if expression true
  1214.  
  1215. WEND
  1216. Mark end of while command sequence
  1217.  
  1218. CONDITIONALS
  1219.  
  1220. IF exp THEN statement/label [ELSE statement/label]
  1221. Conditional statement or expression execution
  1222.  
  1223. varfield=exp ? expr:expr
  1224. Conditional assignment of value to field or variable
  1225.  
  1226. FILE AND INDEX COMMANDS
  1227.  
  1228. CREATE sbfname;passwords
  1229. Create a new database file in memory
  1230.  
  1231. CREATE INDEX ON exp [FILE sbfname] [TO index] [UNIQUE]
  1232. Create a new index file optionally make unique
  1233.  
  1234. ADD [FILE sbfname] field definition string [, formula string]
  1235. Add a new field to a file
  1236.  
  1237. MAKE sbfname
  1238. Make the file exist on disk and store the file def
  1239.  
  1240. MODIFY field [, ] field definition string [, formula string]
  1241. Modify parameters for field changing name, type etc.
  1242.  
  1243. SAVE FILE sbfname
  1244. Save the current file definition
  1245.  
  1246. PASSWORD sbfname;passwords
  1247. Set new passwords for a specified file
  1248.  
  1249. REORGANIZE [FILE sbfname] [TO] pathname
  1250. Reorganize current or specified file to new pathname
  1251.  
  1252. OPEN FILE sbfname;passwords
  1253. Open file set as default
  1254.  
  1255. CLOSE [ALL]/[FILE sbfname]
  1256. Close all or specified files
  1257.  
  1258. FILE sbfname
  1259. Select the default file to be used
  1260.  
  1261. INDEX index
  1262. Select the default index to be used for a file
  1263.  
  1264. REMOVE FILE sbfname
  1265. Remove all data, file and all indices
  1266.  
  1267. REMOVE INDEX index
  1268. Remove the specified index for specified file
  1269.  
  1270. OPEN FIELDS [FILE sbfname] fieldlist
  1271. Open a set of fields for specified file
  1272.  
  1273. CLOSE FIELDS [FILE sbfname]
  1274. Close the open fields for specified file
  1275.  
  1276. RECORD COMMANDS
  1277.  
  1278. BLANK [FILE sbfname]
  1279. Clear all data from current record
  1280.  
  1281. STORE [0/1/2, ] [FILE sbfname]
  1282. Store current record in the file, batch mode optional.
  1283.  
  1284. ENTER [field/nexpr] [, nexpr2]
  1285. Allow the user to enter a record in the current file
  1286.  
  1287. VIEW
  1288. View record in the current file
  1289.  
  1290. SELECT
  1291. Record selection commands
  1292.  
  1293. SELECT FIRST [FILE sbfname] [INDEX index]
  1294. Select the first record in key sequence
  1295.  
  1296. SELECT LAST [FILE sbfname] [INDEX index]
  1297. Select the last record in key sequence
  1298.  
  1299. SELECT NEXT [FILE sbfname] [INDEX index]
  1300. Select the next record in key sequence
  1301.  
  1302. SELECT PREVIOUS [FILE sbfname] [INDEX index]
  1303. Select the previous record in key sequence
  1304.  
  1305. SELECT CURRENT [FILE sbfname] [INDEX index]
  1306. Select the current record in key sequence
  1307.  
  1308. SELECT DUPLICATE [FILE sbfname] [INDEX index]
  1309. Select the next record with the same key
  1310.  
  1311. SELECT REMOVE [FILE sbfname]
  1312. Remove the current record in selected file
  1313.  
  1314. SELECT KEY string [FILE sbfname] [INDEX index]
  1315. Select the first record with index matching string
  1316.  
  1317. SELECT WHERE [FILE sbfname] [conditions]
  1318. Select the first record matching conditions or clear conditions
  1319.  
  1320. SELECT field parms [WHERE parms] [REPORT parms] [ORDER parms]
  1321. [SAY]/[TO PRINTER/filename/FILE sbfname] [END SELECT]
  1322. Query language command
  1323.  
  1324. PROCESS COMMANDS
  1325.  
  1326. UPDATE calc list [WHERE conditions] [END UPDATE]
  1327. Perform relational update
  1328.  
  1329. REMOVE FROM FILE sbfname WHERE conditions
  1330. Remove records matching conditions
  1331.  
  1332. IMPORT filename [[TO] FILE sbfname] [WHERE conditions] [USING parms]
  1333. Import external text file to superbase
  1334.  
  1335. EXPORT [FILE sbfname] [INDEX index] [TO] filename [WHERE
  1336. conditions [USING parms]
  1337. Export to external file
  1338.  
  1339. LABELS [FILE sbfname] [WHERE conditions] [USING labelstring]
  1340. Print labels as per label definition
  1341.  
  1342. MERGE [TEXT filename [WHERE conditions]
  1343. Load text file and mail merge
  1344.  
  1345. INPUT OUTPUT FUNCTIONS
  1346.  
  1347. SHOW field/strexpr
  1348. Show external field
  1349.  
  1350. OPEN filename FOR INPUT/OUTPUT/APPEND/COMM
  1351. Open sequential file for input/output
  1352.  
  1353. POSITION nexp
  1354. Position in sequential file
  1355.  
  1356. INPUT [&nexp/LINE] var/field
  1357. Input characters or line from text file
  1358.  
  1359. CLOSE INPUT/OUTPUT/COMM
  1360. End input/output to/from text file or comms
  1361.  
  1362. SET filename
  1363. Read exec or variable file and execute
  1364.  
  1365. GET var/field
  1366. Get character from keyboard no wait
  1367.  
  1368. WAIT FOR time/FOR nexp/var/field
  1369. Wait till time, for no of secs or for single key entry
  1370.  
  1371. ASK [string] [pos] [length] ;var/field
  1372. Get input string from user
  1373.  
  1374. BELL
  1375. Ring bell
  1376.  
  1377. HOME
  1378. Move screen output position to home
  1379.  
  1380. CLS
  1381. Clear output screen
  1382.  
  1383. EJECT [nexp]
  1384. Do new pages on print device
  1385.  
  1386. SCRDUMP
  1387. Do screen dump to printer
  1388.  
  1389. LOCATE coordinates
  1390. Set position on output device
  1391.  
  1392. NEWLINE [nexp]
  1393. Send newline to output device
  1394.  
  1395. MENU column, item, state [, text]
  1396. Set up a user defined menu
  1397.  
  1398. MENU CLEAR
  1399. Clear user-defined menu
  1400.  
  1401. MENU ON numvar
  1402. Turn on user-defined menus, specify variable for return value
  1403.  
  1404. REQUEST text[, ] text[, ] type [, numvar [, textvar [, len]]]
  1405. Set up a user-defined dialog(requester)
  1406.  
  1407. MEMORY
  1408. List of variables in memory
  1409.  
  1410. STATUS [FILE sbfname]
  1411. Status of selected file or system
  1412.  
  1413. SAY [[USING pitch, mode, rate, sex, phonemes] string [, /;string...]]
  1414. Amiga only. Output string as speech
  1415.  
  1416. FG nexp
  1417. Set foreground colour
  1418.  
  1419. BG nexp
  1420. Set background colour
  1421.  
  1422. UL [ON/OFF]
  1423. Set or clear underline
  1424.  
  1425. IT [ON/OFF]
  1426. Set or clear italics
  1427.  
  1428. BF [ON/OFF]
  1429. Set or clear bold face
  1430.  
  1431. ATTR OFF
  1432. Clear bold face italics and underline
  1433.  
  1434. ? /DISPLAY/PRINT/OUTPUT TO file
  1435. Send information to selected output device
  1436.  
  1437. ? SAY
  1438. Use narrator device to speak output
  1439.  
  1440. ? MEMORY
  1441. List of variables in memory
  1442.  
  1443. ? LIST
  1444. Program listing in memory
  1445.  
  1446. ? STATUS [FILE sbfname]
  1447. Status of selected file or system
  1448.  
  1449. ? DIRECTORY
  1450. Current directory listing
  1451.  
  1452. ? TEXT [MERGE]
  1453. Text file in memory optionally mail merging
  1454.  
  1455. ? QUERY
  1456. Current query statement
  1457.  
  1458. ? exprlist
  1459. Any expression list
  1460.  
  1461. REPORTING
  1462.  
  1463. HEADING statements END HEADING
  1464. Specify statements to execute on page heading
  1465.  
  1466. FOOTING statements END FOOTING
  1467. Specify statements to execute on page footing
  1468.  
  1469. REPORT total list
  1470. Set report totals, means and count
  1471.  
  1472. BEFORE REPORT
  1473. Specify before report activity
  1474.  
  1475. AFTER REPORT
  1476. Specify after report activity
  1477.  
  1478. END REPORT
  1479. End of report specifications
  1480.  
  1481. GROUP field total list
  1482. Specify subtotal break field and subtotals, means and counts for group
  1483.  
  1484. BEFORE GROUP statements
  1485. Specify before group activity
  1486.  
  1487. AFTER GROUP statements
  1488. Specify after group activity
  1489.  
  1490. END GROUP
  1491. End of group specifications
  1492.  
  1493. FORM HANDLING
  1494.  
  1495. CLOSE FORM
  1496. Close current form
  1497.  
  1498. OPEN FORM formname
  1499. Load a form into memory
  1500.  
  1501. FORM [, page [, row [, column]]]]
  1502. Specify page for current and top left-hand corner
  1503.  
  1504. ENTER [FORM view name] [field list
  1505. Enter data into fields through view form
  1506.  
  1507. OPERATORS
  1508.  
  1509. ARITHMETIC OPERATORS
  1510.  
  1511. ^
  1512. Exponentiation
  1513.  
  1514. -
  1515. Negation
  1516.  
  1517. *
  1518. Multiplication
  1519.  
  1520. /
  1521. Division
  1522.  
  1523. MOD
  1524. Modulo arithmetic
  1525.  
  1526. +
  1527. Addition
  1528.  
  1529. -
  1530. Subtraction
  1531.  
  1532. RELATIONAL OPERATORS
  1533.  
  1534. =
  1535. Equality
  1536.  
  1537. LIKE
  1538. Pattern matching case insensitive equality
  1539.  
  1540. <>
  1541. Inequality
  1542.  
  1543. <
  1544. Less than
  1545.  
  1546. >
  1547. Greater than
  1548.  
  1549. <=
  1550. Less than or equal to
  1551.  
  1552. >=
  1553. Greater than or equal to
  1554.  
  1555. LOGICAL OPERATORS
  1556.  
  1557. NOT
  1558.  
  1559. AND
  1560.  
  1561. OR
  1562.  
  1563. MATHEMATICAL FUNCTIONS
  1564.  
  1565. SGN(x)
  1566. Sign of variable
  1567.  
  1568. INT(x)
  1569. Integer portion of variable
  1570.  
  1571. ABS(x)
  1572. Absolute value of variable
  1573.  
  1574. SQR(x)
  1575. Square root
  1576.  
  1577. RND(x)
  1578. Random number
  1579.  
  1580. LOG(x)
  1581. Logarithm
  1582.  
  1583. EXP(x)
  1584. Exponent
  1585.  
  1586. COS(x)
  1587. Cosine
  1588.  
  1589. SIN(x)
  1590. Sine
  1591.  
  1592. TAN(x)
  1593. Tangent
  1594.  
  1595. ATN(x)
  1596. Arctangent
  1597.  
  1598. FIX(x, y)
  1599. Fix decimal precision of value
  1600.  
  1601. FREE(n)
  1602. Return free memory size
  1603.  
  1604. DISKSPACE("disk")
  1605. Return free disk space
  1606.  
  1607. RECCOUNT(sbfname)
  1608. Return number of records in file
  1609.  
  1610. SER(sbfname)
  1611. Return serial number of specified file
  1612.  
  1613. ROW(0)
  1614. Return current screen row
  1615.  
  1616. COL(0)
  1617. Return current screen column
  1618.  
  1619. PROW(n)
  1620. Return current printer row
  1621.  
  1622. PCOL(n)
  1623. Return current printer column
  1624.  
  1625. EOF(sbfname)
  1626. Return if at end of file
  1627.  
  1628. FOUND(sbfname)
  1629. Return result of last search
  1630.  
  1631. LOOKUP(value, fld)
  1632. Return if value exists in file(indexed field)
  1633.  
  1634. STRING FUNCTIONS
  1635.  
  1636. LEN(x$)
  1637. Length of string
  1638.  
  1639. STR$(x[[, y] [, z] / [, numformat]])
  1640. String from number with optional format
  1641.  
  1642. VAL(x$)
  1643. Value of string
  1644.  
  1645. ASC(x$)
  1646. Ascii value of character
  1647.  
  1648. CHR$(x$)
  1649. String value of character
  1650.  
  1651. LEFT$(x$, nexp)
  1652. Left portion of string
  1653.  
  1654. RIGHT$(x$, nexp)
  1655. Right portion of string
  1656.  
  1657. MID$(x$, nexp [, nexp])
  1658. Mid portion of string
  1659.  
  1660. DAYS(x$)
  1661. Numeric value of date
  1662.  
  1663. DATE$(nexp [, dform])
  1664. Date string from numeric using optional format
  1665.  
  1666. DAY(date)
  1667. Numeric day value of date
  1668.  
  1669. DAY$(date)
  1670. Day of week from date
  1671.  
  1672. MONTH(date)
  1673. Numeric month value of date
  1674.  
  1675. MONTH$(date)
  1676. Month string from date
  1677.  
  1678. YEAR(date)
  1679. Numeric year value of date
  1680.  
  1681. TIMEVAL(time)
  1682. Numeric value of time
  1683.  
  1684. TIME$(nexp [, tformat])
  1685. Time string from numeric using optional time format
  1686.  
  1687. HRS(time)
  1688. Number of hours from time
  1689.  
  1690. MINS(time)
  1691. Number of minutes from time
  1692.  
  1693. SECS(time)
  1694. Number of seconds from time
  1695.  
  1696. THOUSECS(time)
  1697. Number of thousandths of second from time
  1698.  
  1699. LCASE$(x$)
  1700. Convert string to lower case
  1701.  
  1702. UCASE$(x$)
  1703. Convert string to upper case
  1704.  
  1705. FCASE$(x$)
  1706. Capitalize first letter of string
  1707.  
  1708. TRIM$(x$)
  1709. Trim trailing spaces from x$
  1710.  
  1711. LTRIM$(x$)
  1712. Trim leading spaces from x$
  1713.  
  1714. INSTR([n, ]x$, y$)
  1715. Find position of substring y$ in x$
  1716.  
  1717. REPLICATE(x$, nexp)
  1718. Replicate character expression n times
  1719.  
  1720. SPACES$(n)
  1721. Return string with n spaces
  1722.  
  1723. ERR$(n)
  1724. Returns error message for error number n
  1725.  
  1726. VARIABLES
  1727.  
  1728. TODAY
  1729. Return system date
  1730.  
  1731. NOW
  1732. Return system time
  1733.  
  1734. ERRNO
  1735. Return current error number
  1736.  
  1737. PI
  1738. Return value of pi
  1739.  
  1740. FIELDS BY NAME
  1741. Fieldname; Field.file; Field. "file"
  1742.  
  1743. MULTIPLE RESPONSE FIELDS
  1744. Fieldname(nexp)
  1745.  
  1746. STRING VARIABLES
  1747. X$
  1748.  
  1749. NUMERIC VARIABLES
  1750. X%
  1751.  
  1752. ARRAYS
  1753. X% or X$(nexp[[, nexp] [, nexp]])
  1754.  
  1755.  
  1756.                      SUPERBASE PROFESSIONAL
  1757.  
  1758. Using Superbase Personal Files
  1759. ------------------------------
  1760.  
  1761. Superbase Personal is upwardly compatible with Superbase 
  1762. Professional; so if you have upgraded from one to the other,  you 
  1763. can use any of the files that you created in Superbase Personal. 
  1764. (It doesn't work the other way round: Professional files cannot 
  1765. be loaded into Superbase Personal.)
  1766.  
  1767. However,  there a number of differences in the way the two 
  1768. programs store file data. You should take these into account when 
  1769. you are loading Personal files into Professional. When you save 
  1770. the files,  Superbase Professional will automatically convert them 
  1771. to its own format. But in some cases you may need to edit your 
  1772. Personal files before you can use them. 
  1773.  
  1774. Here is a checklist of the points to bear in mind when converting 
  1775. files from Personal to Professional:
  1776.  
  1777. *  Professional query files include the details of any database 
  1778.    files associated with a query and these files are opened 
  1779.    automatically when the query is loaded. If you use a Personal 
  1780.    query in Professional,  you will need to open the database 
  1781.    files yourself before loading the query. Then save the query 
  1782.    in order to convert it to the Superbase Professional query 
  1783.    format.
  1784.  
  1785. *  Although Superbase Personal does not offer a Constant field 
  1786.    type,  it allows you to create a special type of calculation 
  1787.    formula which acts like a constant formula. For example,  if 
  1788.    you define a single word formula such as "London" or TODAY it 
  1789.    will have the same effect as the equivalent constant formula 
  1790.    in Superbase Professional. When you load a Personal file into 
  1791.    Professional,  calculated fields will be defined as CLC RDO 
  1792.    fields. If they were originally intended to act as constants,  
  1793.    you should change the CLC attribute to CON by selecting Edit 
  1794.    File and editing the file definition. You may also want to 
  1795.    remove the Read Only attribute.
  1796.  
  1797. *  The list of words that are reserved for the use of the system 
  1798.    is more extensive in Superbase Professional than in Superbase 
  1799.    Personal (see the section on Reserved Words further on in this 
  1800.    document). As a result,  you may find that some of the field 
  1801.    names in your Personal files are treated as reserved words in 
  1802.    Superbase Professional. For example,  Professional offers a 
  1803.    large of number of new functions such as YEAR and HRS. If you 
  1804.    have used YEAR as a field name,  it would now become invalid. 
  1805.    Before loading a Personal file,  check that the field names are 
  1806.    valid; if they are not,  change them by editing the file 
  1807.    definition. 
  1808.  
  1809.  
  1810. Edit Form
  1811.  
  1812. The Project menu option,  Edit Form,  runs the Forms Editor as an additional 
  1813. task if it is not already in memory,  provided there is sufficient RAM 
  1814. capacity. If you have opened a form in Superbase, you can use this option 
  1815. to edit it in the Forms Editor and then return to Superbase. 
  1816.  
  1817. For Edit Form to work,  Superbase must be able to locate the Forms Editor 
  1818. program. First it looks for the program in the current directory and then 
  1819. in the root directory of the current device. If this fails,  Superbase 
  1820. will look in the parameters directory as specified in the Options dialog. 
  1821. If the Forms Editor still cannot be found,  Superbase will assume that 
  1822. it resides on a disk with the volume name SBFORMED:. If this disk is not 
  1823. present in the system,  and you have not used the CLI ASSIGN command to 
  1824. specify the location of SBFORMED:,  then an AmigaDOS requester will 
  1825. prompt you to insert it.
  1826.  
  1827. If the Forms Editor is already running when you select Edit Form, then the 
  1828. Forms Editor window is pulled to the front and made active. The current 
  1829. form in Superbase will also be selected for editing. To Return to Superbase 
  1830. you can use the depth arrangement gadget to push the Forms Editor screen 
  1831. to the back.
  1832.  
  1833.  
  1834. Reorganize
  1835.  
  1836. The primary application for Reorganize is as described in the User Guide. 
  1837. It allows you to reclaim disk space after deleting records from a file,  
  1838. and makes disk operations with the file more efficient. 
  1839.  
  1840. This option can also be used to recover records after their data has been 
  1841. corrupted; i.e.,  when an attempt to open a file produces a disk error 
  1842. message. Reorganize steps over any errors it finds in a file and retrieves 
  1843. as many valid records as it can. The records which have been damaged will 
  1844. be lost when the new file is created so Superbase informs the user with 
  1845. the message: "New file has different record count".
  1846.  
  1847. There may also be circumstances in which Reorganize can be used to recover 
  1848. data which could not be accessed before. For example, if you turned off 
  1849. the computer after storing new records in Batch mode,  the details of these 
  1850. records would not be stored in the file header. Reorganize rewrites the 
  1851. file header so that the records are included in the new file. In this case,  
  1852. it issues another error message (as well as the one above):
  1853.  
  1854. "Source file size incorrect in header".
  1855.  
  1856. Note that the manual suggests that the best way to recover data from a disk 
  1857. error is to Export the remaining records and then import them to a new file. 
  1858. This method has now been superseded by Reorganize.
  1859.  
  1860.  
  1861. Using the Lookup Function
  1862.  
  1863. There are several points to note in connection with the LOOKUP function:
  1864.  
  1865. *  When you are creating a validation formula (in a file definition) that uses 
  1866. LOOKUP,  you should always enter the function's arguments by typing them 
  1867. into the box at the bottom of the validation dialog. In other words,  
  1868. even if your LOOKUP formula contains a field which is shown in the field 
  1869. list above,  you should type the field name into the box instead of 
  1870. clicking on it.
  1871.  
  1872. *  It is important to include the file name as an extension to any field 
  1873. name used with LOOKUP. This applies to all fields irres
  1874. pective of whether their names are unique to one file or not. For example:
  1875.  
  1876.       LOOKUP(Forename.Address, Firstname.Customers)
  1877.  
  1878.    is correct,  while:
  1879.  
  1880.       LOOKUP(Forename, Firstname)
  1881.  
  1882.    may cause problems.
  1883.  
  1884. *  LOOKUP will not work correctly with date/time and numeric fields that have null 
  1885. values -- i.e.,  fields that have been left blank. If you wish to use LOOKUP 
  1886. on fields of this type you must force the first argument to give a null 
  1887. value when empty. For example LTRIM$(DATE$(date field)) will give a null 
  1888. string when the `date field' is empty.
  1889.  
  1890.  
  1891. Amiga Requester Default Keys
  1892.  
  1893. Many of the dialogs in the Amiga version of Superbase accept Return and 
  1894. Escape as keyboard equivalents to clicking on the OK or Cancel buttons. 
  1895. Press the Return key to select OK,  press the Escape key for Cancel. In 
  1896. cases where a casual OK might be destructive,  Superbase does not allow 
  1897. the Return key equivalent.
  1898.  
  1899.  
  1900. Keyboard Equivalents
  1901.  
  1902. In addition to the keyboard equivalents described in the User Guide,  
  1903. Superbase also provides the following:
  1904.  
  1905. Alt/Amiga B          Toggles Bold (text style) on and off in the Text Editor
  1906. Alt/Amiga U          Toggles Underline on and off
  1907. Alt/Amiga I          Toggles Italic on and off
  1908. Alt/Amiga P          Toggles Plain on,  bold,  italic,  and underline off
  1909. Alt/Amiga B          Toggles Batch mode on and off (this option is only 
  1910.              available when the database window is active,  
  1911.              otherwise Alt/Amiga B acts as a keyboard equivalent 
  1912.              for the Bold text style)
  1913. Alt/Amiga A          Select the program command line window --equivalent 
  1914.              to selecting Command from the Program menu.
  1915.  
  1916. Note that `Amiga' indicates the right Amiga key.
  1917.  
  1918. The keyboard equivalent for Set Paging,  Alt/Amiga P, is no longer available.
  1919.  
  1920.  
  1921. New Editing Controls
  1922.  
  1923. Two new controls have now been provided to allow the user to copy lines in 
  1924. the Program Editor and Text Editor. CTRL L is used to select the line you 
  1925. wish to copy; move the cursor to any point on the line and press CTRL L. 
  1926. CTRL R inserts a copy of the line that has previously been selected with 
  1927. CTRL L; move the cursor to the point in the program or document where 
  1928. the line is to be inserted and press CTRL L. A copy of the line will 
  1929. then be inserted below the cursor.
  1930.  
  1931.  
  1932. Current Record Button
  1933.  
  1934. By now you will have noticed that the current record button on the Control 
  1935. panel does not agree with the illustration in the User Guide on page 1-8. 
  1936. Whereas the guide shows a single triangle (as in Superbase Personal),  
  1937. the program now has two triangles pointing in opposite directions from 
  1938. each other. 
  1939.  
  1940. The reason for this is that,  in Superbase Professional,  the button 
  1941. has two functions. As well as acting as the current record button,  
  1942. it also allows you to change current page in a multi-page form. In the 
  1943. first capacity,  it is used to redisplay the current record after the 
  1944. record data has been overwritten or removed from the screen by some 
  1945. other action -- for example,  by Status File. As a page selector,  the 
  1946. same button is used to select either the next page or the previous page. 
  1947. Clicking on the right-hand triangle displays the next page,  clicking 
  1948. on the left-hand triangle displays the previous page.
  1949.  
  1950.  
  1951. Passwords
  1952.  
  1953. In earlier versions of Superbase,  passwords were shown on screen in the 
  1954. Password dialog as you typed them in. Now,  when you type in a password 
  1955. in order to gain access to a file,  the password is not displayed in the 
  1956. Password dialog. 
  1957.  
  1958.  
  1959. RAM disk support (Amiga)
  1960.  
  1961. Normally if you wish to use the Amiga RAM disk within a program, you need 
  1962. to copy data files into the RAM disk before running the program. With 
  1963. Superbase Professional,  this step is unnecessary. You can load data 
  1964. into the RAM disk simply by using the drive identifier RAM: when you 
  1965. open a Superbase file. If the file is not already in the RAM disk,  
  1966. Superbase will copy it to the disk from the current directory,  and open 
  1967. it at the same time. 
  1968.  
  1969. Superbase also provides a similar service when you close the file. It 
  1970. asks if you want the file to be copied back to the current directory,  
  1971. i.e. to the floppy or hard disk it was originally copied from. If you 
  1972. click on OK it does the job for you. Should you click on CANCEL the file 
  1973. will not be copied back and you will be asked if you want to erase the 
  1974. copy you have in the RAM disk. Selecting CANCEL will leave the RAM copy 
  1975. intact. 
  1976.  
  1977. (Note that if you open an existing file on RAM disk which has not been 
  1978. put there by Superbase then when you close that file Superbase will not 
  1979. ask you if you wish to copy it back.)
  1980.  
  1981. As an example,  suppose the Address file is stored on the disk in drive 
  1982. DF1: and the current directory is DF1:. To open this file from the RAM 
  1983. disk you would select the Open File option on the Project menu and then 
  1984. enter:
  1985.  
  1986.    RAM:Address
  1987.  
  1988. You can now work on the file in the normal way -- retrieve data, edit 
  1989. data,  remove records,  and so on -- with the advantage that file operations 
  1990. using a RAM disk are much faster than they are on a physical disk. Remember 
  1991. to close the file at the end of a session so that any changes you have made 
  1992. can be saved permanently in the directory from which it was copied. 
  1993.  
  1994. This feature also works with other Ram disk facilities where the drive 
  1995. identifier is VD0: or VDK:.
  1996.  
  1997.  
  1998. Reserved Words
  1999. --------------
  2000.  
  2001. It should be emphasised that the reserved word list includes all Superbase 
  2002. functions even though they are not listed in Appendix C. You should bear 
  2003. this in mind when you are defining a file or writing a program: many of 
  2004. the DML functions have names which you might tempted to use as field or 
  2005. variable names,  for example HRS, DAY,  MONTH,  YEAR.
  2006.  
  2007. Note also the following keywords which should be added to the list in 
  2008. Appendix C.
  2009.  
  2010.  
  2011.    AS
  2012.    BUFFERS
  2013.    CALL
  2014.    COPY
  2015.    DISK
  2016.    DISKSPACE
  2017.    FIELDS
  2018.    PAGING
  2019.    RECORD
  2020.    TABLE
  2021.  
  2022.  
  2023. Graphics and Form Printing
  2024. --------------------------
  2025.  
  2026. On the Amiga,  Printer on the Set menu has been extended to provide a 
  2027. graphics printing option for forms. Selecting this option displays a 
  2028. sub-menu with two items,  Draft and Graphics. Draft works in the same 
  2029. way as is described in the User Guide, Volume 1. When Draft is set,  
  2030. output that appears on screen is sent to the printer as well; so if you 
  2031. select the next record in the current file,  its field data will be output 
  2032. to the printer. If a form is in use all the text items will be printed as 
  2033. well as the field data. If you wish to print the field data only then you 
  2034. should set the Print Status of the text items to non-printing within the 
  2035. Forms Editor.
  2036.  
  2037. The Graphics option can be used when you are displaying data with a form. 
  2038. It prints all the graphic elements in the form -- lines, boxes,  areas,  
  2039. images,  and so on -- together with all the data the form displays. Data 
  2040. items are printed in the system font,  text items are printed in the 
  2041. fonts and point sizes which were set in the Forms Editor. However,  
  2042. Superbase will also take into account the Print Status of an item as 
  2043. set in the Forms Editor.
  2044.  
  2045. On a 512K Amiga,  you will only be able to print four colour forms in 
  2046. either draft or graphics modes.
  2047.  
  2048.  
  2049. Using Superbase as a Relational System
  2050. --------------------------------------
  2051.  
  2052. Although it is impossible to describe the principles of 
  2053. relational database design in this document,  most users will 
  2054. benefit from an abbreviated account of some of the more important 
  2055. facts.
  2056.  
  2057. When you are contemplating the basic design of a relational 
  2058. database application,  there are three key considerations:
  2059.  
  2060. 1.  Establishing relationships between files. Every pair of files 
  2061.     between which there is to be a relationship must have a field 
  2062.     in each file that will be used as the link between them. 
  2063.     These fields should be designated as key fields,  preferably 
  2064.     with unique indexes.
  2065.  
  2066. 2.  Ensuring integrity of relational link data. At the data entry 
  2067.     stage,  what goes into the link fields described above must be 
  2068.     carefully controlled. The aim is to ensure that,  for example,  
  2069.     an account code (usually a text field) is always entered in 
  2070.     the same case in all files in which it is used. This is done 
  2071.     by setting the text field attribute for each of the link 
  2072.     fields to perform automatic case conversion to either upper 
  2073.     or lower case; obviously the conversion must be the same for 
  2074.     both fields. Validation formulas may also be necessary to 
  2075.     check the pattern of what is entered,  its length,  or the 
  2076.     range of acceptable values.
  2077.  
  2078.     The second control on data integrity is via the LOOKUP 
  2079.     function. This enables the system to check what is entered 
  2080.     into the link field in one file against what already exists 
  2081.     in the link field in the other file. For example,  you would 
  2082.     always want to check that a product was in stock before 
  2083.     accepting an order for it. The LOOKUP function is attached to 
  2084.     the link field in the file definition as a validation 
  2085.     formula. However,  if you are using links as described in the 
  2086.     next paragraph,  you must ensure that none of your LOOKUP 
  2087.     functions tries to check for a record that you are still in 
  2088.     the process of creating!
  2089.  
  2090. 3.  Including links in a multi-file form. If you want to design 
  2091.     forms which can retrieve data from more than one file,  you 
  2092.     must use the Set Link menu option in the Forms Editor to 
  2093.     create the links between the files. In Set Link,  you specify 
  2094.     the link fields described above as the master (or primary) 
  2095.     and secondary link fields.
  2096.  
  2097. At the other end of the application,  you will want to retrieve 
  2098. data from your relational system in the most convenient way. 
  2099. There are a number of ways of doing this.
  2100.  
  2101. 1.  Browsing. Use a multi-file form with links set up as 
  2102.     described above. The video buttons operate in the usual way,  
  2103.     and you can switch files and indexes to vary the order of 
  2104.     retrieval. The printer may be used to obtain draft or 
  2105.     graphics hard copy.
  2106.  
  2107. 2.  Queries. The Process Query Edit menu option can be used to 
  2108.     set up multi-file queries,  which may be stored on disk. 
  2109.     Output may include any fields from files between which a 
  2110.     relation is specified in the Filter,  and can be sorted as you 
  2111.     wish. Report functions may be added,  as well as limited 
  2112.     formatting,  but output is basically columnar and non-graphic.
  2113.  
  2114. 3.  Reports. Report programs may be generated automatically with the 
  2115. Forms Editor or written directly in the program editor (the Program 
  2116. Edit menu option). The forms editor allows for multi-line headings and 
  2117. footings,  many levels of subtotalling and sorting,  and full page 
  2118. field positioning,  as well as offering many other features. Relations 
  2119. between files are derived from the links between files,  so here again 
  2120. you must use the Set Link menu option before saving the report form. 
  2121. Output is non-graphic.
  2122.  
  2123.  
  2124. Further Rules for Constructing Queries
  2125. --------------------------------------
  2126.  
  2127. In multi-file queries,  the user (especially the programmer) must 
  2128. exercise extra care to ensure that the query is efficient. The following 
  2129. rules should be observed:
  2130.  
  2131. 1.  Files are processed in the order in which they are mentioned in the 
  2132. WHERE statement (Query Filter Line). In some cases you will want to process 
  2133. the smallest file first,  in some cases you won't. You may have to experiment 
  2134. to find the optimum query for a particular application.
  2135.  
  2136. 2.  Every file reference in the WHERE statement must be part of a chain. 
  2137. WHERE A=B AND B=C is acceptable,  but WHERE A=B AND C=D is not. A simple 
  2138. rule of thumb is that there should always be one less join than the 
  2139. number of files in the query.
  2140.  
  2141.  
  2142. Superbase Start Options
  2143. -----------------------
  2144.  
  2145. When you run SBpro from the CLI,  you can use the following 
  2146. optional parameters:
  2147.  
  2148. SBpro [-c] [-r] [-fformname] [-p] [-s] [-z]
  2149.  
  2150. -c Selects custom screen
  2151. -r Disables returns (chr$(13)) when writing to disk files
  2152. -f Loads form at startup time
  2153. -p Removes remote control panel
  2154. -s Removes scroll bars from Superbase window
  2155. -z removes sizing gadget and disable sizing
  2156.  
  2157. NOTE: Remember to set the stack to at least 8000 before running Superbase 
  2158. from the CLI.
  2159.  
  2160. The start options are also available from the Workbench by setting Tool 
  2161. Types in the Info for the SBpro icon as follows:
  2162.  
  2163. SCREEN=WORKBENCH                    Use Workbench        
  2164. SCREEN=CUSTOM                       Use custom screen
  2165. RETURN=ON                           Enable returns        
  2166. RETURN=OFF                          Disable returns
  2167. SYSTEM=NOPANEL|NOSCROLL|NOSIZE      Remove panel scroll bars and size gadget
  2168.  
  2169. You also may use any combination of the three options in the SYSTEM item.
  2170.  
  2171. You can load a form at startup by creating an icon for it with the default 
  2172. tool set to SBpro and then double clicking on it.
  2173.  
  2174.                DATABASE MANAGEMENT LANGUAGE (DML)
  2175.  
  2176. Changes to DML
  2177. --------------
  2178.  
  2179. Programmers should be aware of the following changes,  extensions and 
  2180. undocumented features in Superbase's Database Management Language:
  2181.  
  2182. 1.  The LOOKUP function is case sensitive -- for example, LOOKUP("fred", 
  2183.     Firstname.Address) will not find an occurrence of "Fred".
  2184.  
  2185. 2.  The record SELECT commands (SELECT NEXT,  SELECT LAST,  SELECT KEY etc) 
  2186.     have been amended so that they now take another optional parameter,  FORM.
  2187.     The effect of this parameter is to activate any multi-file links that 
  2188.     have been set in a form. If it is not used,  the SELECT commands only 
  2189.     operate on the current file and ignore any links between files.
  2190.  
  2191.     FORM must be placed immediately after SELECT. For example, with SELECT 
  2192.     NEXT command,  you would enter: SELECT FORM NEXT.
  2193.  
  2194. 3.  The KEY command now accepts a numeric key as well as a string key.
  2195.  
  2196. 4.  The commands EJECT,  LOCATE,  and FOOTING do not operate when the 
  2197.     current output device is the screen and PAGING is OFF. You can,  
  2198.     however,  use LOCATE with paging off to set the column position -- 
  2199.     but not the row position.
  2200.  
  2201. 5.  FORM. This command takes another optional parameter,  SHOW,  which is 
  2202.     used to display external files. If the form contains external file fields,
  2203.     FORM SHOW is equivalent to clicking on the camera button. The syntax for 
  2204.     FORM is:
  2205.  
  2206.        FORM [SHOW] [page [, row, column]]
  2207.  
  2208.     Note that the `page' parameter is now optional. When it is omitted 
  2209.     and the FORM command is used without any following parameters,  
  2210.     Superbase only displays the field data in a form and omits any other 
  2211.     objects. 
  2212.  
  2213. 6.  The command SET BUFFERS only sets the size of the disk buffers for 
  2214.     the current session. If you want to set the number of buffers to be 
  2215.     saved with the parameters file (SB.PAR),  use the new command SAVE SET.
  2216.  
  2217. 7.  SET TABLE/RECORD/FORM can be followed by the ON parameter. This switches 
  2218.     to the specified view mode even if there is a form in memory. Normally
  2219.     SET TABLE, for example, acts as a toggle between Table view and the form. 
  2220.     If Table view is the current view mode,  this command would switch in 
  2221.     the form. SET TABLE ON,  however,  would leave the current view mode 
  2222.     as it is. The advantage of this option is that it enables the programmer 
  2223.     to select a view mode without having to keep track of what the current 
  2224.     mode is.
  2225.  
  2226. 8.  During the execution of a program,  BREAK OFF disables the Stop button 
  2227.     and CONTROL-C; also,  you cannot use the space bar to pause during 
  2228.     program execution. When the program has finished,  BREAK is turned on 
  2229.     again.
  2230.  
  2231. 9.  Apart from the Stop and Pause button,  the remote control panel is 
  2232.     disabled while a program is running. Stop is only disabled if the 
  2233.     BREAK OFF command has been issued,  Pause is available at all times.
  2234.  
  2235. 10. STORE takes another optional parameter,  FORM. If FORM is used all the 
  2236.     records in the current form are saved; otherwise STORE only saves the 
  2237.     record which belongs to the current file. 
  2238.  
  2239.     The new syntax for this command is:
  2240.  
  2241.        STORE [, 0/1/2] [FORM]/[FILE sbfname]
  2242.  
  2243.     Note that STORE , 2 secures not only the current file but 
  2244.     also any other open files. It is therefore not necessary to 
  2245.     follow it with the FORM or FILE parameters and,  in fact,  
  2246.     adding one of these parameters to STORE , 2 will cause an 
  2247.     error.
  2248.  
  2249. 11. BLANK can also take FORM as an optional parameter. With a multi-file 
  2250.     form,  BLANK FORM creates blank records for each file represented in 
  2251.     the form. When the FORM parameter is not included,  BLANK only creates 
  2252.     a blank record for the current file. 
  2253.  
  2254.     The syntax for this command is:
  2255.  
  2256.        BLANK [FORM]/[FILE sbfname]
  2257.  
  2258. 12. If SELECT DUPLICATE does not find a duplicate of the current index 
  2259.     field,  it leaves the current record unchanged.
  2260.  
  2261. 13. A string function should not contain more than one intermediate 
  2262.     string concatenation. For example,  
  2263.  
  2264.        LEFT$("abcde", LEN("x" + "y")) 
  2265.  
  2266.     contains only one intermediate concatenation and gives the correct 
  2267.     result,  but
  2268.  
  2269.        LEFT$("ab" + "cde", LEN("x" + "y"))
  2270.  
  2271.     gives the wrong result because it contains two concatenations -- 
  2272.     "ab" + "cde" and LEN("x" + "y").
  2273.  
  2274. 14. Superbase already provides you with equivalents for the system commands 
  2275.     (or disk utilities) Delete,  Rename and Copy. If you want to use some of 
  2276.     the other disk utilities without switching screens or exiting from 
  2277.     Superbase,  you can do so with the CALL command. On the Amiga,  you 
  2278.     enter:
  2279.  
  2280.        CALL "NEWCLI" 
  2281.  
  2282.     This opens a CLI window on the Workbench screen,  and you can then type 
  2283.     in and execute any of the AmigaDOS commands. Alternatively,  you can 
  2284.     execute a DOS command directly without first typing it in the CLI window. 
  2285.     Thus to list the directory for drive DF1: you would enter:
  2286.  
  2287.        CALL "DIR DF1:"
  2288.  
  2289.     The directory will then be output in either the CLI window used to run 
  2290.     Superbase or the small Superbase window opened on the Workbench screen.
  2291.  
  2292.     You may want to use CALL to run a program which requires input from the 
  2293.     keyboard. In this case,  you should follow the program file name with the
  2294.     `<*' parameter,  as in:
  2295.  
  2296.       CALL "fcopy <*"
  2297.  
  2298.     The effect of this parameter is to redirect input from `stdin',  
  2299.     allowing you to type in data from the CLI window. 
  2300.  
  2301. 15. With commands that set a single file filter using WHERE (for example,  
  2302.     IMPORT,  EXPORT and SELECT WHERE) you can include ASK as the parameter 
  2303.     to the WHERE statement. The effect of ASK is to display the standard 
  2304.     filter dialog when the command is executed,  thus allowing the user 
  2305.     to set a filter while a program is running. If a filter is present 
  2306.     when ASK is executed,  the filter expressions will be presented as a 
  2307.     default for the dialog.
  2308.  
  2309.     Examples are:
  2310.  
  2311.        SELECT WHERE ASK 
  2312.  
  2313.     In this example,  ASK causes the filter dialog to be presented. Entering 
  2314.     the following filter line (at run-time):
  2315.  
  2316.        Lastname LIKE "[r-z]*" 
  2317.  
  2318.     would have the same effect as executing the command:
  2319.  
  2320.        SELECT WHERE Lastname LIKE "[r-z]*"
  2321.  
  2322.     However,  a partial filter like this is not allowed:
  2323.  
  2324.        SELECT WHERE datefield > ASK
  2325.  
  2326. 16. ENTER. The parameters for this command can only be used with a form. 
  2327. With other view modes,  ENTER (on its own) places the data entry cursor 
  2328. in the first open field that is not Read Only.
  2329.     
  2330. 17. REQUEST. There is now an additional dialog type with the dialog number 19. 
  2331.     This displays a list of the forms in the current directory. Note that 
  2332.     the description in the DML User Guide for dialog type 5 is incorrect. 
  2333.     This dialog provides a list of the fields in the current file. 
  2334.  
  2335. 18. SHOW. The command now takes an optional extension to allow or remove the 
  2336.     menu bar from the EFMS screen: 
  2337.  
  2338.       SHOW [MENU ON/OFF] [field]/[strexpr]
  2339.  
  2340. 19. ? QUERY. The syntax for this command has been extended to make it easier 
  2341.     to select a device for output. It is no longer necessary to select an 
  2342.     output device before executing ? QUERY. Instead you should specify the 
  2343.     device using the TO parameter. The new syntax is:
  2344.  
  2345.       ? QUERY [TO device]
  2346.       
  2347.     where `device' can be the printer,  an ASCII file or a new `.sbf' file. 
  2348.     If this parameter is not included output is to the screen. The device 
  2349.     options are:
  2350.  
  2351.       TO PRINTER
  2352.  
  2353.     Outputs to the printer.
  2354.  
  2355.       TO FILE filename
  2356.  
  2357.     Creates an `.sbf' file on disk under the file name specified.
  2358.  
  2359.       TO filename
  2360.  
  2361.     Outputs to the ASCII file specified by `filename'.
  2362.  
  2363. 19. IF THEN ELSE. The explanation of block IF THEN statements given in 
  2364.     the manual needs to be supplemented by two further points:
  2365.  
  2366.     *  Every block IF THEN statement must end with an END IF statement. 
  2367.        (Example 4 on page 5-69,  Volume 2,  requires a second END IF after 
  2368.        the last line.)
  2369.  
  2370.     *  Within a block IF THEN statement,  you can insert one or more ELSE 
  2371.        IF statements. These are used to extend the number of alternatives 
  2372.        provided by the original block IF THEN (so that it has the same 
  2373.        effect as the CASE statement found in some versions of Basic); but 
  2374.        they do not require additional END IF statements.
  2375.  
  2376.     The following examples should make these points clear:
  2377.  
  2378.       IF a% THEN
  2379.       ? atrue$
  2380.       IF b% THEN
  2381.       ? btrue$
  2382.       ELSE
  2383.       ? bfalse$
  2384.       END IF
  2385.       ELSE
  2386.       ? afalse$
  2387.       END IF    
  2388.  
  2389.       IF a% =1 THEN 
  2390.       ? "one"
  2391.       ELSE IF a% = 2 THEN
  2392.       ? "two"
  2393.       ELSE IF a% = 3 THEN
  2394.       ? "three"
  2395.       ELSE 
  2396.       ? "Not 1 to 3"
  2397.       END IF
  2398.  
  2399.  
  2400. New DML Commands
  2401.  
  2402. 1.  SET PG
  2403.     Use this command to set the page size on your printer. It takes the 
  2404.     syntax:
  2405.  
  2406.        [SET] PG rows [, columns [, ss]]
  2407.  
  2408.     where rows specifies the number of rows on the page and column specifies 
  2409.     the number of columns (the page width). ss stands for single sheet and 
  2410.     takes a value of 0 or 1. 0 specifies that single sheet paper is used,  
  2411.     0 specifies continuous stationery,  also known as fan-fold paper. SET 
  2412.     is optional.
  2413.  
  2414.     An example of the use of SET PG would be:
  2415.  
  2416.        SET PG 50,  65,  1
  2417.  
  2418.     This line sets the format for a printed page to 50 lines of no more 
  2419.     than 65 characters. It also tells Superbase that the printer takes 
  2420.     continuous stationery.
  2421.  
  2422.     You can use this command in a program or from the command line to  
  2423.     customize a page for any kind of printed output -- whether you are 
  2424.     printing a text file,  record data or a report. However setting up 
  2425.     the printer in Preferences on the Amiga will override the PG settings.
  2426.  
  2427. 2.  SET PRINTER ON [, 0/1] / OFF
  2428.     This is the program equivalent of selecting Print on the Set menu. 
  2429.     The 0 parameter specifies draft mode printing,  and the 1 parameter 
  2430.     specifies graphics mode printing. Use this command in conjunction with 
  2431.     FORM to obtain form printouts. After SET PRINTER ON has been executed,
  2432.     any output to the screen will also be sent to the printer,  so remember 
  2433.     to SET PRINTER OFF when the print operation is complete.
  2434.  
  2435. 3.  SAVE SET
  2436.     This command saves the Superbase parameter file. It is equivalent to 
  2437.     clicking on OK in the Options dialog. All the parameters that have set 
  2438.     in the dialog (and those that are set elsewhere) will be saved on disk 
  2439.     in the file SB.par.
  2440.  
  2441. 4.  SET MIN
  2442.     This command sets the minimum size allowed for the Superbase window. 
  2443.     It takes two optional parameters,  the minimum width and height of the 
  2444.     window in pixels,  so the full syntax is:
  2445.  
  2446.       SET MIN [width [, height]]
  2447.  
  2448.     Maximum width is 640,  maximum depth is 183. SET MIN without parameters 
  2449. allows the programmer to lock the window to its current size while a program 
  2450. is running. You cannot use SET MIN to set the window larger than its size 
  2451. when the command is executed. SET MIN can also be executed from the command 
  2452. line or a function key.
  2453.  
  2454.  
  2455. User-Defined Menus
  2456.  
  2457. Other points to note in connection with the commands MENU and MENU ON are:
  2458.  
  2459. *   The first item defines the width of a menu in terms of the number of 
  2460. characters. When you define the text string parameter for item 1 you may 
  2461. need to allow for the width of other items in the menu by adding spaces 
  2462. to the end of the string.
  2463.  
  2464. *   If you wish to use checkmarks in your menus,  remember to leave a space 
  2465. for the checkmark character when you define the MENU text string -- the first 
  2466. character in the string should be a space.
  2467.  
  2468. *   MENU on its own clears all the menu settings (as do ERASE and CLEAR).
  2469.  
  2470. *   After the MENU ON command has been executed,  any menus that have 
  2471. been defined remain active until an item has been selected. The program 
  2472. example on page 5-91 of the DML User Guide is slightly misleading on this 
  2473. point since it suggests that the MENU ON command needs to be executed 
  2474. repeatedly. A better way of checking whether an item has been selected 
  2475. would be:
  2476.  
  2477.       MENU ON a%, b%
  2478.       menuloop: 
  2479.       ON a% GOSUB sub1,  sub2,  sub3
  2480.       GOTO menuloop
  2481.  
  2482.     Note,  however,  that the MENU ON command should be executed again 
  2483. after an item has been selected in order to reset the menu variables to 0. 
  2484.  
  2485.                      FORMS AND FORM HANDLING
  2486.  
  2487. Changing Text Fonts
  2488.  
  2489. Contrary to what is stated in the Forms Editor User Guide,  text fonts 
  2490. can be altered without deleting the text and typing it in again. In fact,  
  2491. the text font can be treated in the same way as the text style,  as one of 
  2492. the text object's attributes.
  2493.  
  2494. To change the font,  first select the object by double clicking on it; 
  2495. then select the new font from the Fonts menu.
  2496.  
  2497.  
  2498. Using External Files in a Form
  2499.  
  2500. You can use external file fields in a form in the same way as you do in a 
  2501. database file. The difference is that the external files are displayed 
  2502. in the field boxes rather than in a separate window. This means that 
  2503. multiple external files can be displayed at the same time. 
  2504.  
  2505. When you load the form into Superbase,  the box for an external field 
  2506. will show the data in the current record; i.e.,  the name of an external 
  2507. file. To display the file in the box,  click on the camera button. If a 
  2508. box which contains an image file extends beyond the screen,  Superbase 
  2509. will move the form so that it shows as much of the image or text as possible.
  2510.  
  2511. The result of entering a box -- by clicking on it,  or by pressing Return 
  2512. after editing the previous field in the field order -- differs according 
  2513. to whether it contains a text file or an image file. If you enter a text 
  2514. box,  Superbase replaces the box with the Text Editor window (which is 
  2515. given the same dimensions as the box). You can then edit the text in the 
  2516. normal way. Closing the Text Editor window or clicking in another part of 
  2517. the screen, restores the text to the field box, and moves on to the next field.
  2518.  
  2519. With images,  the effect of entering an external field box is to activate the 
  2520. image colour map: the image is displayed in its original colours. Otherwise,  
  2521. the image is displayed in the default colours of the form.
  2522.  
  2523. These facilities for showing text and images in external field boxes only 
  2524. operate if the box is more than one character deep. For this reason,  the 
  2525. first thing you should do after placing an external field on a form (in the 
  2526. Forms Editor) is resize it. 
  2527.  
  2528.  
  2529. Amiga Colour Palette
  2530.  
  2531. On the Amiga,  the Colour Palette option (in the Attributes window) has 
  2532. been altered to reflect this computer's special colour features. The 
  2533. Palette now works in the same way as the Preferences colour changing 
  2534. option. It also offers several extra facilities not available in Preferences 
  2535. or in Gem versions of the Forms Editor.
  2536.  
  2537. You may find it helpful to read the section on page 3-9 of the Forms 
  2538. Editor Guide as an introduction to the ideas underlying this feature,  
  2539. but for detailed instructions on how to use the palette you should 
  2540. consult the next section. 
  2541.  
  2542.  
  2543. Changing the Colour Palette (Amiga only)
  2544.  
  2545. When you click on the Colour Palette icon in the Attributes window,  
  2546. the Forms Editor will present you with the Colour Selection dialog (requester).
  2547. At the top,  there are three sliders for defining a colour in terms of its 
  2548. RGB (Red,  Green and Blue) values and a box showing the currently selected 
  2549. colour. The set of colours available to you is shown below in the same format 
  2550. as in the Attributes window -- as two rows of eight colours. If you have 
  2551. previously set the resolution to 4 or 8 colours,  only the first 4 or 8 
  2552. colours will be available and the rest of them will be ghosted. 
  2553.  
  2554. To change one of the colours in the Palette,  first select it by clicking on 
  2555. its box in the colour panel. The Forms Editor will then do two things: it 
  2556. will display the colour in the box at the top left-hand corner of the 
  2557. Colour Selection,  and it will reset the sliders to reflect the RGB values 
  2558. for the colour you have selected. You can now change the colour by moving 
  2559. the sliders in the same way as you would if you were using Preferences. 
  2560. When you have finished,  click on OK to return to the current Forms Editor 
  2561. page.
  2562.  
  2563. By using this technique,  you could define all the colours in the Palette,  
  2564. setting the RGB values for each of them in turn. The Forms Editor also 
  2565. provides several other options which allow you to change a number of colours 
  2566. at a time. These options are indicated by the buttons below the colour panel.
  2567.  
  2568. The Copy button enables you to copy a colour from one box to another. The 
  2569. procedure is as follows: first,  click on the colour you wish to copy; 
  2570. second,  click on the Copy button; third,  click on the target colour to 
  2571. which the first colour is to be copied.
  2572.  
  2573. With the Range button you specify the two colours at either end of the 
  2574. range and the Forms Editor then adjusts the colours in between. If you 
  2575. specified white and dark blue,  for example,  the colours in between would 
  2576. be changed to shades of blue from light to dark.
  2577.  
  2578. To set a colour range,  click on the colour which is to form the starting 
  2579. point (or the end point) for the range,  click on the Range button,  
  2580. then click on the colour at the other end of the range. 
  2581.  
  2582. The Read Prefs button at the right of the colour panel changes the first 
  2583. four colour boxes to the colours that have been set in Preferences. The 
  2584. Reset button reverses the effects of any changes you may have made and 
  2585. restores the colours that were set before you selected the Colour Palette.
  2586.  
  2587.  
  2588. Report Functions
  2589.  
  2590. Apart from COUNT the report functions -- SUM,  MIN,  MAX,  MEAN,  VAR 
  2591. and S.D. -- can only be used with numeric fields. These functions operate 
  2592. either on all the records in a group (if used in an AFTER GROUP section) 
  2593. or on all the records in the report (in an AFTER REPORT section).
  2594.  
  2595. SUM
  2596. Gives the field total for all the records in a group or report.
  2597.  
  2598. MIN
  2599. Returns the minimum value of the specified field among the records in 
  2600. a group or the report.
  2601.  
  2602. COUNT
  2603. Returns the number of records in a group or the report. Unlike the other 
  2604. functions,  COUNT should not be followed by a field name -- it operates 
  2605. on the field specified in the REPORT or GROUP box.
  2606.  
  2607. MAX
  2608. Returns the maximum value of the specified field among the records in a 
  2609. group or for the report.
  2610.  
  2611. MEAN
  2612. Returns the average value of the field data in a group or in the whole 
  2613. report.
  2614.  
  2615. VAR (Variance)
  2616. Provides a measure of the spread of the data from its mean.
  2617.  
  2618. S.D. (Standard Deviation)
  2619. Provides a measure of the spread of the data from its mean -- for the 
  2620. field data in a group or over the entire report.
  2621.  
  2622.  
  2623. Amiga Images
  2624. ------------
  2625.  
  2626. When you add an image to the page,  the Amiga version of the Forms Editor 
  2627. gives you a choice over the colours the image takes. A dialog appears with 
  2628. the message:
  2629.  
  2630.      Use image colour map?
  2631.  
  2632. Clicking on OK selects the image colour map and resets the colour palette 
  2633. to those colours. If you click on Cancel,  the image will be displayed 
  2634. using current range of colours as shown in the Attributes window. The form 
  2635. designer should ensure that only images compatible with the resolution and 
  2636. colour of the form are used.
  2637.  
  2638.                         FORM CALCULATIONS
  2639.  
  2640. Calculation  Types
  2641. -----------------
  2642.  
  2643. The calculations you add to a form have a number of features 
  2644. which are not covered in the Forms Editor guide (you should 
  2645. ignore the calculation examples given in the guide). In fact,  
  2646. with forms that are designed to be used in Superbase,  
  2647. calculations can play a far more important role than is suggested 
  2648. in the guide. This section describes these features in detail.
  2649.  
  2650. Calculations take the same names as DML variables. If they are 
  2651. intended to store string data,  the last character must be `$'; if 
  2652. they are used to store numeric data,  the last character must be 
  2653. `%'.  Calculations referred to by another calculation must 
  2654. already have been added to the form.
  2655.  
  2656. When you create a calculation,  you will be presented with a 
  2657. calculation dialog where you enter the formula for the 
  2658. calculation. Initially,  it will show a list of the fields in the 
  2659. current file which have been added to the form. If you want to
  2660. refer to other calculations in the formula,  click on the multi-
  2661. file gadget. The calculation names will then be listed as if they 
  2662. were fields belonging to a file called FORMCALCS. 
  2663.  
  2664. There are four different types of form calculation,  and each has 
  2665. its own syntax.
  2666.  
  2667. 1.  Blank calculations. These are calculations which do not have 
  2668.     a formula attached to them. They provide a means of 
  2669.     interacting with a form from a program and can be treated as 
  2670.     program variables.
  2671.  
  2672.     To define a calculation of this type,  first enter its name 
  2673.     and then,  without entering a formula,  click on OK in the 
  2674.     formula dialog. Once the form has been loaded into Superbase,  
  2675.     the calculation can be used as a link between the form and a 
  2676.     program. This works both ways: you can assign a value to a 
  2677.     calculation-variable either by typing it in the calculation's 
  2678.     box on the form or by executing an assignment statement in a 
  2679.     program. 
  2680.  
  2681.     Suppose,  for example,  you defined a blank calculation with 
  2682.     the name fred%. In the form's field order fred% is number 5. 
  2683.     If you wanted to input data to a program from the form which 
  2684.     contains fred%,  you would include the program line:
  2685.  
  2686.        ENTER 5
  2687.  
  2688.     When this line is executed,  the input cursor will appear on 
  2689.     screen in the box belonging to fred% and the value entered by 
  2690.     the user will be assigned to fred%. If you now executed the 
  2691.     Memory command,  fred% and its contents will be listed along 
  2692.     with all the other program variables. And any other DML 
  2693.     commands which operate on variables,  such as CLEAR,  will also 
  2694.     work with a calculation variable.
  2695.  
  2696.     To assign the value 22.5 to fred% from within the program,  
  2697.     you would execute the statement:
  2698.  
  2699.        fred% = 22.5
  2700.  
  2701.     This value will then be shown in the calculation box when the 
  2702.     form display is next updated. 
  2703.  
  2704.     Note that ENTER is the only input command that can be used 
  2705.     with a form. Forms are object oriented rather than character 
  2706.     oriented so you cannot use ASK or GET in combination with 
  2707.     LOCATE. Another point to note is that you can only identify a 
  2708.     calculation by its field order number; a command such as:
  2709.  
  2710.      ENTER fred% 
  2711.  
  2712.     will not work.
  2713.  
  2714. 2.  Standard calculations. These function in the same way as the 
  2715.     calculations which are attached to fields,  and they take 
  2716.     exactly the same syntax. In fact,  they can be regarded as a 
  2717.     special kind of field which only exists on a form.
  2718.  
  2719.     The calculation name should not occur in the calculation 
  2720.     formula unless it is a self-referencing calculation. Instead 
  2721.     the result is automatically assigned to the calculation when 
  2722.     the formula is performed; that is,  after each of these 
  2723.     events:
  2724.  
  2725.     * Saving a record    * Moving the cursor through the calculation box
  2726.     * Clicking in the calculation box
  2727.     * Retrieving another record,  e.g. by clicking on the Next 
  2728.       Record button or with the command SELECT NEXT 
  2729.     * When you press Return after entering data in the box (only 
  2730.       possible if the calculation is not Read Only)
  2731.  
  2732.     Typically,  this type of calculation is used to derive a total 
  2733.     from the contents of other calculations or fields and then to 
  2734.     display it on the form. Another application would be to 
  2735.     display a date by using the keyword TODAY in the formula. 
  2736.     Examples are:
  2737.  
  2738.       Calculation name         Calculation formula
  2739.  
  2740.       subtot1%                 Quantity * Price
  2741.       name$                    Left$(Firstname, 1) + ". " + Lastname
  2742.       When$                    TODAY
  2743.  
  2744.     If you want to create a self-referencing calculation (see 
  2745.     Self-referencing Formulas,  Chapter 2,  Volume 1),  you need to 
  2746.     add the calculation to the page and then edit it.
  2747.  
  2748. 3.  LET calculations. The formula for this type of calculation 
  2749.     must start with an assignment statement with LET as the first 
  2750.     word. It is used to assign a calculated value to a field or 
  2751.     another calculation. The field may belong to the current file 
  2752.     or another open file. 
  2753.  
  2754.     An example would be:
  2755.  
  2756.       LET Amount.invoice = quantity * cost
  2757.  
  2758.     where this formula is attached to the calculation fred%.
  2759.  
  2760.     Quantity times Cost will be evaluated in the same 
  2761.     circumstances as for type 2 calculations and the result will 
  2762.     displayed on screen in the calculation box belonging to 
  2763.     fred%.
  2764.  
  2765.     When a new record is retrieved,  things happen slightly 
  2766.     differently. The right-hand part of the formula is evaluated 
  2767.     and displayed,  but the value is not assigned to the field 
  2768.     named to the left of the equals sign.
  2769.  
  2770.     As with the other types of calculation,  the result determines 
  2771.     whether the calculation should be defined as a string or 
  2772.     numeric variable; i.e. for a string result,  the calculation 
  2773.     name must end with the `$' character; for a numeric result,  
  2774.     the name must end with the `%' character.
  2775.  
  2776.     If you are using a LET calculation to send or `post' data to 
  2777.     a record in another file,  remember to save the record after 
  2778.     completing a task. 
  2779.  
  2780. 4.  Executable calculations. These calculations contain program 
  2781.     statements which are executed when the user passes through the 
  2782.     calculation box or clicks on it.
  2783.  
  2784.     A calculation of this type must begin with a DML command as opposed 
  2785.     to the name of a variable,  field or calculation. But, to distinguish 
  2786.     it from other types of calculations,  the command word should not be 
  2787.     LET,  AFTER or POST.
  2788.  
  2789.     Apart from this,  executable commands follow the same rules as for 
  2790.     command line statements. Almost any single or multi-statement DML 
  2791.     program line can be entered as an executable calculation. This 
  2792.     provides immense scope for creating powerful forms with their own 
  2793.     built-in processing facility.
  2794.  
  2795.     At the simplest level,  you could use an executable calculation to 
  2796.     assign strings to function keys for use in data entry. For example:
  2797.  
  2798.       Key 1,  "London": Key 2,  "New York": Key 3,  "Paris": Key 4,  ...
  2799.  
  2800. More complex applications include running a program, executing another 
  2801. calculation,  etc.
  2802.  
  2803. You can even use the calculation itself as a variable into which the 
  2804. user can enter a value. Thus the following command string could be assigned 
  2805. to the calculation f$:
  2806.  
  2807.       IF f$ = "A" THEN .....  ELSE .....
  2808.  
  2809. To force a calculation,  make it Read Only and next in order.
  2810.  
  2811. You can only make a calculation self-referencing by creating then editing it.
  2812.  
  2813.  
  2814. Calculation Prefixes
  2815.  
  2816. In addition to the four calculation types, there are two prefixes, AFTER and 
  2817. POST,  which can be placed in front of the formulas for types 2 and 3.
  2818.  
  2819. AFTER 
  2820. The purpose of AFTER is to force a formula to be performed more frequently 
  2821. than it would be normally. It is followed by an optional field name and 
  2822. is separated from the rest of the formula by a colon. For example:
  2823.  
  2824.     AFTER : Quantity * Price
  2825.  
  2826. Here AFTER forces the formula to be performed whenever any event occurs 
  2827. on the form -- if you click on or pass through a field, when you select 
  2828. a new record,  and when the form is saved. In the example above,  if the 
  2829. formula was attached to the calculation aa1%,  the result would be displayed 
  2830. in aa1%'s box every time the user clicked the mouse in the box or in any 
  2831. other box on the form.
  2832.  
  2833. If a field name is supplied,  AFTER only takes effect after an event 
  2834. relating to the field specified. In the example below, we'll assume the 
  2835. formula is attached to the calculation Tot1%:
  2836.  
  2837.      AFTER Item: Subtot1% * 1.15
  2838.  
  2839. Tot1% will be assigned the result of the formula `Subtot1% * 1.15' after 
  2840. each of these events:
  2841.  
  2842. *  the cursor passes through the Item field
  2843. *  the user clicks in the Item box 
  2844. *  the value of Item changes
  2845. *  all the usual events that cause evaluation of the formula
  2846.  
  2847. POST 
  2848. Just as there are some calculation formulas which need to be performed 
  2849. repeatedly -- for these you will use AFTER -- so there are others which 
  2850. should only be performed once,  when a record is saved. With POST,  you 
  2851. can ensure that a result is only stored in a field (posted to another file) 
  2852. after the other calculations in the form have been carried out.
  2853.  
  2854. POST takes the syntax:
  2855.  
  2856.    POST [LET xxx =] expression
  2857.  
  2858. where xxx is a field name and the expression can be another field,  
  2859. a calculation,  or a formula which calculates a result. The expression 
  2860. is not evaluated until the record is stored,  unless the LET part of the 
  2861. formula is included. If this is the case,  the expression is evaluated 
  2862. subject to the normal rules,  but the assignment of LET is not made until 
  2863. the record is stored.
  2864.  
  2865. Take,  for example,  the formula:
  2866.  
  2867.    POST LET Cust_Balance.Customers = Cust_Balance.Customers +    
  2868.    Order_Amount.Orders
  2869.  
  2870. Order_Amount could represent the final figure in a series of calculations 
  2871. which work out the final value of an order. Clearly, we do not want the 
  2872. total to be stored in the Customers file until all the calculations have 
  2873. been performed. By preceding the formula with POST we can ensure that this 
  2874. condition is satisfied. However,  intermediate results can be shown on the 
  2875. form by clicking in the calculation box to which this formula is attached.
  2876.  
  2877.                           MISCELLANEOUS
  2878.  
  2879. *   In some circumstances the Update option may skip some of the 
  2880.     records in the file it is updating. The problem occurs when 
  2881.     the update modifies a field which also forms part of the 
  2882.     update filter; for example,  it would occur if the update 
  2883.     fields instruction was:
  2884.  
  2885.        Salary = Salary * 1.075
  2886.  
  2887.     and the update filter was:
  2888.  
  2889.        Salary >= L8000 
  2890.  
  2891.     The solution is to enclose the filter statement in 
  2892.     parentheses,  as in:
  2893.  
  2894.        (Salary >= L8000)
  2895.  
  2896.     If you were running this example update under program 
  2897.     control,  you would place the entire WHERE statement within 
  2898.     parentheses:
  2899.  
  2900.       (WHERE Salary >= L8000)
  2901.  
  2902.     This solution works by disabling the automatic optimization 
  2903.     which causes the problem.
  2904.  
  2905. *   If you try to print a line longer than the line length set in 
  2906.     Superbase's Printer options,  Superbase will output a Carriage 
  2907.     Return followed by a Line Feed when it reaches the maximum 
  2908.     line length.
  2909.  
  2910. *   Note that Amiga owners can set a printer initialization 
  2911.     sequence from within Superbase's Set Options dialog. This 
  2912.     allows you to set the features and modes you prefer. The 
  2913.     sequence of control codes is sent to the printer each time 
  2914.     you perform a printing operation from within Superbase. If a 
  2915.     sequence is present Superbase does not send the `Skip over 
  2916.     perforation OFF' and `Set page length' codes that are 
  2917.     normally sent when the printer is accessed.
  2918.  
  2919. *   The output format parameters BF,  UL,  IT enable you to set 
  2920.     different print styles within a report or in the output from a 
  2921.     query. If you wish to set other printing features,  you can do 
  2922.     so by using the CHR$ function to insert the appropriate printer 
  2923.     control codes. With a report which has been generated in the Forms 
  2924.     Editor,  you will need to insert the control code sequences in the 
  2925.     report program. In a query,  you can simply enter them in the query 
  2926.     fields line. For example,  on some Epson printers,  the sequence 27,  
  2927.     14 selects enlarged print, and the control code 20 turns it off. To 
  2928.     output the data for one field in enlarged print,  your query Fields 
  2929.     line might look like this:
  2930.  
  2931.       Firstname,  Lastname,  CHR$(27);CHR$(14);City;CHR$(20),  Street
  2932.  
  2933.     Note that some control codes may be inappropriately 
  2934.     interpreted by the printer device,  in which case you should 
  2935.     set Print Raw on the Options requester to bypass the 
  2936.     interpretation.
  2937.  
  2938. *   Path names. Superbase accepts path names up to 40 characters 
  2939.     long (not including the file name).
  2940.  
  2941. *   File Names. Avoid using the characters : ? # / ; or the space 
  2942.     character. When using a file name as an argument to a command 
  2943.     such as OPEN FILE,  it must always be inside quotation marks. 
  2944.     However,  a file name used to extend a field name,  e.g. 
  2945.     Name.Customers,  need not be inside quotes,  unless it includes 
  2946.     non-alphanumeric characters,  i.e. other than a-Z and 0-9. 
  2947.     Superbase supplies quotes when necessary during dialog 
  2948.     selections,  but if you type a command line in directly be 
  2949.     sure to observe this rule.
  2950.  
  2951. *   The Duplicate option on the Record menu re-initializes any 
  2952.     constant formulas. This means you can duplicate a record 
  2953.     which contains the constant formula SER without duplicating 
  2954.     its serial number. Similarly,  if a file uses the constant 
  2955.     formula TODAY,  creating a new record by duplicating an 
  2956.     existing record does not reproduce the original date.
  2957.  
  2958. *   Superbase and the Forms Editor require a large amount of chip 
  2959.     memory when printing a form in graphics mode. If your Amiga 
  2960.     only has 512K RAM,  the graphics print option may not be 
  2961.     usable.
  2962.  
  2963. *   The DML LABELS examples on page 5-78 are wrong. Example 1 
  2964.     should not suggest that the command can extend over more than 
  2965.     one line; example 2 requires the keyword FILE after LABELS.
  2966.  
  2967. *   The normal New Line sequence on the Amiga is a CHR$(10) (line 
  2968.     feed). On most other machines and in Superbase,  the default 
  2969.     New Line sequence is CHR$(13) CHR$(10) (carriage return,  line 
  2970.     feed). The CHR$(13) may be suppressed,  for example to achieve 
  2971.     compatibility with the ED editor,  by setting RETURN=OFF in 
  2972.     the Tool Types list of the Superbase icon,  which may be 
  2973.     modified using the Workbench Info option.
  2974.  
  2975. *   GET and WAIT (1). Control characters can be returned in GET 
  2976.     and WAIT statements. If these are saved in a file which is 
  2977.     subsequently LISTed,  they will generate the "File contains 
  2978.     non-text characters" error. Note also that CONTROL-C,  the 
  2979.     standard interrupt key,  does not stop program execution if 
  2980.     returned in GET or WAIT. It is up to the program to detect 
  2981.     the value and act appropriately.
  2982.  
  2983. *   GET and WAIT (2). WAIT makes the window active before it 
  2984.     starts waiting for input,  so if the window becomes inactive 
  2985.     for any reason you cannot reactivate it. If this is a problem 
  2986.     for your application,  use GET instead; however,  you will not 
  2987.     be able to input into any other window,  such as a CLI window,  
  2988.     because GET continually reactivates the Superbase window.
  2989.  
  2990. *   The CLEAR statement must be placed last on a program line.
  2991.  
  2992. *   You may want to convert Superbase text files (`.sbt' files) 
  2993.     to ASCII files. The technique for doing this is:
  2994.  
  2995.      1. Rename the `.sbt' file,  giving it a different extension. 
  2996.         E.g.,  rename `Merge.sbt' as `Merge.asc'.  
  2997.      
  2998.      2. Load the file into the Text Editor. Its name will not appear 
  2999.     in the list of files presented by the Project Open 
  3000.         dialog and you will have to type it into the dialog box 
  3001.         (remember to include the extension name).
  3002.  
  3003.      3. Delete the lines containing information about ruler 
  3004.         lengths. These will be blank lines except for two figures 
  3005.         which give the start and end points for the ruler that is 
  3006.         attached to the following paragraph.
  3007.  
  3008.      4. Save the file using the same name with which it was loaded.
  3009.  
  3010.  
  3011.  end
  3012.  
  3013.